Definitive guide to failover

I’ve read many articles and watched many videos on this subject but not set it up for years. Just re-visiting this for a client. Is there a definitive guide for this on RouterOS v6 these days? Requirement is quite simple. WAN1 connection on Ether1. WAN2 on Ether2. Use WAN1 in preference unless data stops flowing through it in which case failover to WAN2. Fail back when connection comes back up.

V6 is not much different for failover. You have all the same choices:

Route Failover
/ip route add gateway=192.168.1.1 distance=1 check-gateway=ping
/ip route add gateway=192.168.2.1 distance=2
The first gateway will begin as its distance is smaller (default 1); the check-gateway will make sure it is up. When the ping will fail, it will disable the first gateway and the second will take over and when the first one comes up, it will return to its function.

(https://help.mikrotik.com/docs/display/ROS/Load+Balancing)

If you want to check an internet host to know if WAN should failover, that’s needs “recursive routing”. The ONLY difference here between V6 and V7 is the “scope”/“target-scope” in the recursive route, since rules changes from = to >= in resolving scope — but AFAIK the V7 scope/target-scope in example should also work on V6:
https://help.mikrotik.com/docs/pages/viewpage.action?pageId=26476608

Also, one thing that is better in V6 if your WAN using dhcp-client to get it’s Internet address is you can use a “dynamic-in” rule to set the need “check-gateway=ping” used in both of the above approaches:

/routing filter add chain=dynamic-in distance=1 set-check-gateway=ping

Note: the default-route-distance set in /ip/dhcp-client need to match above rule to set check-gateway=ping

Overall, a route’s distance= controls the order of WAN selection, outside other factors. So if both WANs are DHCP (or LTE, in which case the default-route-distance in the APN profile), it really is dirt simple to set the default-route-distance=1 on primary and …=2 on secondary & use above rule & done. If the ISP gateway fails, it will failover. NOW, you need recursive routing if you want to cover cases where the ISP’s gateway is pingable but has no internet beyond that.

See paragraph I for starters. — https://forum.mikrotik.com/viewtopic.php?t=182373

Thanks for all the references. Will be having a look at this during the week. Last time I did this, I used a couple of small scripts. Think that was to handle the DHCP nature of the WAN links.