Community discussions

MikroTik App
 
Zapnologica
Long time Member
Long time Member
Topic Author
Posts: 594
Joined: Fri Sep 25, 2009 8:15 pm
Location: South frica

How tp set up a backup internet connection

Wed Jun 09, 2010 10:19 pm

Hi.


Ok i have an adsl 4 meg line as my main internet conenction.

The mikrotik dials a PPPoE to get the internet. Now i want to install a back up internet source (not adsl line)

The back up source is a wireless connection to annother network.


So if the adsl line goes down it must switch its traffic and route it via the other network. And if possible it must email me informing me the adsl line is down?




So my thoughts are that we are going to ping the main gateway and if that fails it mus then switch. but im not sure what to do with the masquerading if the backup line is just a normal tcp/ip network?


is there maybe a wiki or tutorial that can help me set this up?

Thanks
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: How tp set up a backup internet connection

Wed Jun 09, 2010 11:09 pm

http://wiki.mikrotik.com/wiki/Two_gateways_failover

You just masquerade on both interfaces to the interface IP addresses. Traffic leaving through the main link get source NAT'd to the IP address on that main link, traffic leaving through the backup link get source NAT'd to the IP address on the backup link.
/ip firewall nat
add chain=srcnat action=masquerade out-interface=main-link-interface
add chain=srcnat action=masquerade out-intertface=backup-link-interface
To get emailed on failure the easiest thing is to implement a netwatch script that also pings the main link's gateway and emails you on host down and up. Make sure you implement a firewall rule that blocks ICMP towards that main gateway from going out the backup link so that the router can only ping the main gateway through the main link.
/ip firewall filter
add chain=output dst-address=ip.of.main.gateway action=drop
http://wiki.mikrotik.com/wiki/Manual:Tools/Netwatch
 
Zapnologica
Long time Member
Long time Member
Topic Author
Posts: 594
Joined: Fri Sep 25, 2009 8:15 pm
Location: South frica

Re: How tp set up a backup internet connection

Wed Jun 09, 2010 11:44 pm

Thanks allot i shal give it a try.

And does usermanager count all traffic? local and internet? and it will count internet regardless of which link its using.


And with all the internet firewall rules, like remotedesktop , webserver etc will they all still apply on both links.


Or instead of it emailing me. would it not be easier to maybe set it up to do what the hotspot does.
And if its using the backup link then every now and then i will direct you to a html page (that you have uploaded) saying the backup link is being used.????


And how can i totally isolate my system from that backup link . cause the lan wire goes to a Nanostation 2 set as a router which then goes to the IT guys shop which has internet, but if u know the ipaddresses you can acces info on my network.
How can i make it so that just ineternet goes in and out, and so the computers on my network dont find computers on his network??

Thanks
 
Zapnologica
Long time Member
Long time Member
Topic Author
Posts: 594
Joined: Fri Sep 25, 2009 8:15 pm
Location: South frica

Re: How tp set up a backup internet connection

Tue Jun 29, 2010 10:07 pm

Ok,

So you know my backup adsl line is not a PPPOE connection, its like jsut a normal lan wire to annother network.


How do i get the RB750 to route that?

Will it use the same rules as the PPPOE or what?


So i just need to add a NAT masquerade rule for each one, same settings just diff out internefaces/

Then past in that route code in the link you gave me?
 
Zapnologica
Long time Member
Long time Member
Topic Author
Posts: 594
Joined: Fri Sep 25, 2009 8:15 pm
Location: South frica

Re: How tp set up a backup internet connection

Tue Jun 29, 2010 10:21 pm

also annother issue i have thought of is.

All your dst nats, rely on incoming interface. like remote desktop, webserver etc

Now if the internet connection goes to the backup line then none of those will work?
 
Pada
Member Candidate
Member Candidate
Posts: 150
Joined: Tue Dec 08, 2009 11:37 pm
Location: South Africa, Stellenbosch

Re: How tp set up a backup internet connection

Wed Jun 30, 2010 10:46 am

What I've done was to add default routes for both my PPPoE and failsafe Internet connections, with the PPPoE one's distance set to 1 and the failsafe one's distance set to 2. I've also enabled the option on the PPPoE interface to ping the gateway to check if the Internet connection is active. Unfortunately that isn't always reliable, since the Internet problem might sometimes occur further upstream than the first gateway, here in South Africa where I live.
eg. here's a printout of my default routes
/ip route
0 ;;; Default WAN connection via PPPoE
        dst-address=0.0.0.0/0 gateway=PPPoE-WAN interface=PPPoE-WAN
        check-gateway=ping gateway-state=reachable distance=1 scope=30 
        target-scope=10 
1 ;;; Failover WAN connection via wire
        dst-address=0.0.0.0/0 gateway=192.168.1.1 distance=2 scope=30 
        target-scope=10
Yes, you'll either have to create copies of your dst-nat (port forward) entries for the 2nd WAN interface, or you can make dst-nat jumps for both WAN interfaces and then have common port forwarding rules as I've done in this post of mine: http://forum.mikrotik.com/viewtopic.php ... 99#p215499
 
Zapnologica
Long time Member
Long time Member
Topic Author
Posts: 594
Joined: Fri Sep 25, 2009 8:15 pm
Location: South frica

Re: How tp set up a backup internet connection

Wed Jun 30, 2010 11:28 am

Im in SA too.

Ok so i have done that in static routes.

Now my problem is, for arguments sake say i pull out ether1 (main line) cable and then i onlyplug in ether2(2ndary line) my router does not work? The computers dont have internet.

now i am thinking its because its not a PPPoE link, its jsut a normal lan cable to the nextdoor companies network router. ( just for backup internet)

Do i have to add anything because its just acting as a normal router?
 
Pada
Member Candidate
Member Candidate
Posts: 150
Joined: Tue Dec 08, 2009 11:37 pm
Location: South Africa, Stellenbosch

Re: How tp set up a backup internet connection

Wed Jun 30, 2010 11:37 am

You probably have to enable NAT (Masquerading) on the ether2 interface, otherwise only your router would have Internet access on the failover connection.

For a start, see if you can ping network hosts like www.take2.co.za via your ether2, using the ping tool on the router. If that works, then disable pull out the cable of ether1 and see if you can ping that same host without specifying ether2 as the ping interface.
If those worked, then you can go and try to ping from a PC behind the router.
 
Zapnologica
Long time Member
Long time Member
Topic Author
Posts: 594
Joined: Fri Sep 25, 2009 8:15 pm
Location: South frica

Re: How tp set up a backup internet connection

Wed Jun 30, 2010 12:05 pm

Oh ok i will try that.

its just there is a problem i just thought of.


The main internet conenction gets its DNS server automaticaly from the ISP


with my backup line i need to manual assign them to 192.168.5.1 how do i make it change the dns when it changes internet conenctions
 
Pada
Member Candidate
Member Candidate
Posts: 150
Joined: Tue Dec 08, 2009 11:37 pm
Location: South Africa, Stellenbosch

Re: How tp set up a backup internet connection

Wed Jun 30, 2010 12:11 pm

I'll host the DNS server on the MikroTik too and then let DHCP assign your router's IP address for the clients to use as their DNS server.
Then in your DNS settings, you can setup a primary and secondary DNS server.

I don't have any experience with DNS failover, so someone else should perhaps give recommendations here.
 
Zapnologica
Long time Member
Long time Member
Topic Author
Posts: 594
Joined: Fri Sep 25, 2009 8:15 pm
Location: South frica

Re: How tp set up a backup internet connection

Wed Jun 30, 2010 12:20 pm

Yea thats what i currently have running now.

But under DNS settings is the main Internet's DNS servers and not the backup one.

So if line1 goes down and line 2 kicks in then all the computers will still be using line1 dns servers and not line 2
 
Pada
Member Candidate
Member Candidate
Posts: 150
Joined: Tue Dec 08, 2009 11:37 pm
Location: South Africa, Stellenbosch

Re: How tp set up a backup internet connection

Wed Jun 30, 2010 12:32 pm

Alternatively you could try to use DNS servers that would work on both Internet connections.
 
Zapnologica
Long time Member
Long time Member
Topic Author
Posts: 594
Joined: Fri Sep 25, 2009 8:15 pm
Location: South frica

Re: How tp set up a backup internet connection

Thu Jul 01, 2010 2:14 am

Yea, I thought of that. but i would ideally want the dns server to be on my RB.

But its cool i think i got it allworking now.

Well the internet works on each i have not tested if it automaticaly switches over yet?



Where does it ping to? cause if its the next thing wont that be your ADSL modem?



Also just a question.

In stead of wrighting a script for the RB to email me when the line goes down would it not be possible to accasionaly pop up a webpage saying mane line is down you are currently working on the backup line, please phone xxxxxxx to report this.

So you can use a simelar technique to how hot spot redirects you to its page? or just the advertising part of hot spot?
 
Zapnologica
Long time Member
Long time Member
Topic Author
Posts: 594
Joined: Fri Sep 25, 2009 8:15 pm
Location: South frica

Re: How tp set up a backup internet connection

Wed Sep 22, 2010 12:22 am

You dont know of any script that can jsut check if a PPPoE connection is conneted or not? (if it has that 'R' on the left of its name)


and then email me once it is dissconnected for more than 10min and then again when it comes on line?
 
Zapnologica
Long time Member
Long time Member
Topic Author
Posts: 594
Joined: Fri Sep 25, 2009 8:15 pm
Location: South frica

Re: How tp set up a backup internet connection

Wed Nov 17, 2010 4:34 pm

any one know a script that can ping and if it fails 3 times it sends a email?

I want my router to email me when my main internet is down?

Who is online

Users browsing this forum: cmmike, Google [Bot], itsbenlol, SanchoHa, svh79 and 39 guests