MikroTik failover with recursive routes

Check each provider using a reachable address beyond its own gateway.

A ping check against the provider gateway may pass while the network beyond the gateway is down. A recursive default route can track an external address through that provider.

How the route resolves

Choose one probe address per provider. Its host route resolves only through the matching link. The associated default route uses that probe as a recursive next hop.

Example configuration

# each probe is reachable only through its assigned provider
/ip route
add dst-address=192.0.2.53/32  gateway=203.0.113.9   scope=10 comment=beacon-isp1
add dst-address=198.51.100.53/32 gateway=198.51.100.17 scope=10 comment=beacon-isp2

# default routes via the recursive probe next hops
add dst-address=0.0.0.0/0 gateway=192.0.2.53    target-scope=11 check-gateway=ping distance=1 comment=isp1
add dst-address=0.0.0.0/0 gateway=198.51.100.53 target-scope=11 check-gateway=ping distance=2 comment=isp2
Choose dedicated probes

A host route pins the probe to one provider. Avoid using an address that clients need to reach through whichever link happens to be working.

NAT during failover

Sessions established through the old uplink usually have to reconnect. Existing masquerade state is tied to the address and route used when the session began.

Verification

/ip route print where dst-address=0.0.0.0/0
/tool traceroute 8.8.8.8 count=1
# simulate a fault by blocking the ISP1 probe
/ip firewall filter add chain=output dst-address=192.0.2.53 protocol=icmp action=drop comment=TEST

Verify that the active default route changes to isp2 when the first probe fails. Remove the temporary test rule when done.