Mikrotik + 2 WANS + Failover

Hello everyone again :slight_smile:

I’ve been following this simple [u]guide[/u] to setup 2 WANS for our Office. One for the web/http/ftp/ssh/mysql traffic and one for the rest. Works like a charm but I want to also add a failover option.

In case one WAN connection is down, to redirect all traffic to the other one, and vise versa - and also to get an email alert about it.

Thanks!

To clarify, do you want inbound connections to failover?

I’d probably consider some kind of script to update the DNS on failover, although I believe the proper way of doing it would be BGP.

The Guide that you linked has the routing table…

/ip route
add gateway=10.10.11.1 routing-mark=ISP2
add gateway=10.10.10.1 routing-mark=ISP1
add gateway=10.10.10.1

What you need to do is add a second default route on the main table and make sure that check gateway is enabled and add a distance.

/ip route
add check-gateway=ping distance=10 gateway=10.10.11.1

Since this second default route has distance set to 10 it will not take traffic over the first default route that does not have a distance on it until the first route goes unreachable. Make sure that check gateway is enabled for both of the default routes on the main table.

That should be it but you’ll have to try it out and see if you need to change your mangle rules once one of the ISP’s go down.

As far as an email when one of the ISP’s goes down. The simplest thing to do would be add a netwatch for each of your ISP’s gateway IP’s. Have the Netwatch email you when they go up or down.

/tool netwatch
add down-script=“/tool email… down” host=10.10.10.1 up-script=“/tool email… up”
add down-script=“/tool email… down” host=10.10.11.1 up-script=“/tool email… up”

Thanks mate!