WAN Failover with Dynamic IP from ISP and default route

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?

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…

  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.

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.

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?

Setup as per Tevolo’s first post and use recursive routing to ping any host you desire.

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.

Same here.

That article: http://wiki.mikrotik.com/wiki/Advanced_Routing_Failover_without_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?

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/t/netwatch-style-script/55074/1

-Greg

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.