Community discussions

MikroTik App
 
jake101
just joined
Topic Author
Posts: 2
Joined: Thu Jan 21, 2010 11:48 pm

WAN Failover with Dynamic IP from ISP and default route

Tue Jun 01, 2010 5:48 pm

I know the MT prescribed way to implement a WAN failover is to implement the 'check gateway' parameter and then have an additional default route with a greater distance.

Is there any way to implement this with a dynamic default route as the DHCP client creates this route automatically other than creating a script?
 
User avatar
sergejs
MikroTik Support
MikroTik Support
Posts: 6695
Joined: Thu Mar 31, 2005 3:33 pm
Location: Riga, Latvia
Contact:

Re: WAN Failover with Dynamic IP from ISP and default route

Wed Jun 02, 2010 8:39 am

For Dynamic route (from DHCP) you can only set distance,
/ip dhcp-client set default-route-distance=
 
janisbvp
Frequent Visitor
Frequent Visitor
Posts: 76
Joined: Thu Jul 15, 2010 10:33 am

Re: WAN Failover with Dynamic IP from ISP and default route

Wed Dec 21, 2011 2:19 pm

For Dynamic route (from DHCP) you can only set distance,
/ip dhcp-client set default-route-distance=
...meaning, that if I have 2 dynamic ip ISP connections, I have no good way of setting up failower?
All I see is setups with static ip's and thet is not an option - at least backup ip is dynamic for me...
 
User avatar
tevolo
Member Candidate
Member Candidate
Posts: 114
Joined: Sun Mar 29, 2009 8:39 pm

Re: WAN Failover with Dynamic IP from ISP and default route

Tue Feb 28, 2012 11:03 pm

1. Under DHCP Client, Remove (uncheck) Default Route for each DHCP WAN connection. (Just make note what the actual Default Route is for each WAN Connection under IP Route first).
2. Setup your own default route for each connection under IP Route.
/ip route add gateway=192.168.1.1 check-gateway=ping
/ip route add gateway=192.168.2.1 distance=2
192.168.1.1 in this case is the default route for WAN1
192.168.2.1 is the default route (and backup WAN connection) for WAN2.
 
itcoresys
newbie
Posts: 26
Joined: Mon Oct 03, 2011 7:14 am

Re: WAN Failover with Dynamic IP from ISP and default route

Wed Feb 29, 2012 5:03 am

Another way that is working for me is to also uncheck "add default route" in the DHCP client entry and instead add a static route of 0.0.0.0/0 with a distance of 1 for your preferred interface and the same static route with a different distance pointed to the next preferred interface.

Just use the interface as the gateway instead of an IP. This way if your provider renumbers, you dont have to reconfigure.
 
User avatar
tevolo
Member Candidate
Member Candidate
Posts: 114
Joined: Sun Mar 29, 2009 8:39 pm

Re: WAN Failover with Dynamic IP from ISP and default route

Thu Mar 01, 2012 6:19 pm

Does anybody have a solution if the gateway is your local modem, and although it is on and working, the cable company cut the internet for some reason, so it could ping the gateway but has no internet? Instead of a ping check on the gateway, is there a way to ping some internet source like a DNS server?
 
User avatar
skillful
Trainer
Trainer
Posts: 552
Joined: Wed Sep 06, 2006 1:42 pm
Location: Abuja, Nigeria
Contact:

Re: WAN Failover with Dynamic IP from ISP and default route

Fri Mar 02, 2012 11:41 pm

Setup as per Tevolo's first post and use recursive routing to ping any host you desire.
 
gotsprings
Forum Guru
Forum Guru
Posts: 2118
Joined: Mon May 14, 2012 9:30 pm

Re: WAN Failover with Dynamic IP from ISP and default route

Tue Jul 03, 2012 7:14 pm

The page linked to with recursive routing... is that out dated with 5.18? I can't paste those commands into new terminal and have them work.
 
itcoresys
newbie
Posts: 26
Joined: Mon Oct 03, 2011 7:14 am

Re: WAN Failover with Dynamic IP from ISP and default route

Tue Aug 07, 2012 2:05 am

Same here.

That article: http://wiki.mikrotik.com/wiki/Advanced_ ... _Scripting

Doesnt work for me either.

Only the recursive addresses are reachable via the static routes, not anything else following the default routes pointed at the recursive address.

Is there something missing from that article that needs to mark routes with the routing-marks?
 
gsloop
Member Candidate
Member Candidate
Posts: 213
Joined: Wed Jan 04, 2012 11:34 pm
Contact:

Re: WAN Failover with Dynamic IP from ISP and default route

Fri Aug 10, 2012 10:05 pm

I wrote a script that handles this. I don't know that it's better than the linked stuff - I haven't looked at it.

However, it does several things I find useful.
Rather than simply up if any pings return, you can set the level of packet-loss that should result in a "practically" down pipe.
You can ping ANY IP/host - not just the gateway - which helps with the loss being upstream. [Just pick the IP/Host carefully - you'd like that host to be as good an indicator of problems as possible.
-Too far away and you'll drop the pipe when nothing's wrong, only the route to that host.
-Too close, and you'll still get to it when there are peering problems, for example - so it will keep the pipe "up" when things are really down.

I'm using it and I'm very happy.
See: http://forum.mikrotik.com/viewtopic.php?f=9&t=60247

-Greg
 
spaxton
Member Candidate
Member Candidate
Posts: 192
Joined: Fri Jan 01, 2010 12:18 pm

Re: WAN Failover with Dynamic IP from ISP and default route

Tue Jul 19, 2016 1:18 am

Same here.

That article: http://wiki.mikrotik.com/wiki/Advanced_ ... _Scripting

Doesnt work for me either.

Only the recursive addresses are reachable via the static routes, not anything else following the default routes pointed at the recursive address.

Is there something missing from that article that needs to mark routes with the routing-marks?
This actually works... You don't need any routing marks. Making two recursive gateways is enough to do the job. However, this was meant to be used with fixed IP addresses but even if Your ISP gives You a dynamic address, gateway will be the same in most cases. I made some test enviroment and tested this and it works just fine. I even configured a netwatch to send me an email when the main internet line is broken. Here is the screenshot so You can see how does it look like.
Unnamed QQ Screenshot20160719001013.jpg
Best Regards.
You do not have the required permissions to view the files attached to this post.

Who is online

Users browsing this forum: GoogleOther [Bot], quezhou, raulico and 87 guests