Dual WAN Failover Script Ping Command

As rextended stated, look up recursive routing in search!!
http://forum.mikrotik.com/t/advanced-routing-failover-without-scripting/136599/1
is a long winded thread on the topic.

Basically one wants to use existing DNS servers to verify not only if the connection to the ISP server is good but that the connection from the ISP server to the internet is also working.

What you haven’t described as requested is a clear set of requirements.

  1. Is their a primary and secondary gateway
  2. Do you have one subnet that should use one gateway and use the other gateway as backup or not
  3. Do you have another subnet that should use the other gateway and use the gateway in 2. as backup or not.

What type of ISP connections (same provider? different provider? static or dynamic?)


Here is an example of my setup with a primary network of Bell Fibre (1gig up/down) and a secondary Eastlink Cable.
Note that all our email is done through Eastlink.

/ip route
add check-gateway=ping distance=3 gateway=1.0.0.1
add check-gateway=ping distance=4 gateway=9.9.9.9
add comment=PrimaryRecursive distance=3 dst-address=1.0.0.1/32 gateway=
primarygateway_IP scope=10
add comment=SecondaryRecursive distance=4 dst-address=9.9.9.9/32 gateway=
primarygateway_IP scope=10
add comment=SecondaryWAN distance=10 gateway=secondarygateway_IP
add comment=Email_bypass distance=2 dst-address=secondaryISP-emailserver_IP gateway=
secondarygatewayIP