Failover between three Mikrotik routers

Good day,

I have setting up a failover between three Mikrotik routers. Router1 is the main router where the internet comes into the environment and the other two routers are connected to Router1. They’re all communicating with each other as their’s no firewall NAT rules in place.

Each of the routers are installed in different buildings, have their own set up servers and pc and run independently from each other.
Router1 = Main Building
Router2 = Building2
Router3= Building3

I need to setup a failover, so that if the connection between Main Building (Router1) and Building 2 (Router2) breaks for whatever reason, the traffic to Building1 should be routed via Router3 as a failover and vice versa. Is this possible, and if so, what type of config will I need in order to achieve this? There is a link between Router2 and Router3, which can be connected to another eth port.

I did look up on how failover on Mikrotik works, but nothing I can find on the internet explains my type of situation, where most instructions talk routing to a different ISP using masquerade rules and so on.

I want to share my current configs, but not sure how to export it into a readable format for the forum

Thanks for any help or insight in advance.

You need additional set of routes on each of the routers with a higher distance than the direct ones.

For example on r2 you have a route to r1 via interface1 and to r3 via interface2 with distance 0.
Now you need to add routes: to r1 via r3 address, and to r3 via r1 address with distance >0.
And this way on all three.

Let us suppose that we have several WAN links, and we want to monitor, whether the Internet is accessible through each of them www.upsers.com The problem can be everywhere. If your VPN cannot connect - then there’s no problem, your default route with gateway=that-vpn-connection will be inactive.

Thanks for the reply. What would my address and gateway for the failover be if my current config is as follows:

Router1 IP = 10.0.100.1
Router2 IP = 10.0.100.2 GW = 10.0.100.1 eth1
Router3 IP = 10.0.100.3 GW = 10.0.100.1 eth1

Each of the routers has a different subnet used for servers and hosts, so the 10.0.100.0 range are used for the routers
I’ve tried so many different things, but nothing seems to work, so I don’t know what I’m missing.

You don’t need to change any existing addresses, routes. Just add additional routes (IP → Routes).

So you’re saying, Router2 would be: dist = 10.0.100.2 GW = 10.0.100.3 and then Router3 would be the other way around, I.E dist = 10.0.100.3 GW = 10.0.100.2?

On router 2 it could look like this:

/ip route
add distance=10 dst-address=0.0.0.0/0 gateway=10.0.100.1
add distance=20 dst-address=0.0.0.0/0 gateway=10.0.100.3

On router 3 it could look like this:

/ip route
add distance=10 dst-address=0.0.0.0/0 gateway=10.0.100.1
add distance=20 dst-address=0.0.0.0/0 gateway=10.0.100.2

Wait. If r1-r2 and r1–r3 are bridged together, then just bridge r2-r3 link with them and run stp on the briges. That would be the easiest way.

You can do this with static routes and distance settings, i.e. installing static routes on all three pointing to each other and using gateway check to remove them from being active…

or you can do this via dynamic protocol.. i.e. setup OSPF on all three routers < ---- That would be the preferred way :slight_smile:

If you have just 1 or 2 subnets in each router you can use static routing, but if you have mode I would prefer OSPF