Configure failover

Hello,

I'm new to the Mikrotik world and this forum :slight_smile:

I have a Mikrotik router running the OS 7.20.8 and device Hap ax2

I have two internet connections, one on port 1 et other port 2

lan on port 5

I’m trying to set up failover when the internet connection goes down, not just when the gateway goes down

So I’ve set up two routing tables: one for ISP 1 and another for ISP 2, which has a static route to 8.8.8.8

I’ve set up a NetWatch script that disables the default route for the failing ISP to switch to the other ISP

I'm noticing some unusual behavior: my default route for ISP 2 is activating even though my interface isn't connected.

What is the best configuration for setting up Internet link monitoring with a Mikrotik?

Below is the configuration of my NetWatch script as well as the routing tables

/tool netwatch add comment=WAN-1 disabled=no down-script="/ip route disable [find comment=default-WAN1]" host=8.8.8.8 interval=5s src-address=192.168.100.249 test-script="" timeout=1s type=icmp up-script="/ip route enable [find comment=default-WAN1]"
/tool netwatch add comment=WAN-2 disabled=no down-script="/ip route disable [find comment=default-WAN2]" host=8.8.8.8 src-address=192.168.99.247 test-script="" type=icmp up-script="/ip route enable [find comment=default-WAN2]"

Thank you for your help.

First step (for me) would be checking the documentation, there is a page for basic failover:

You should also consider upgrading your hAP AX2 as this device has a vulnerability (if miss configured).

I’d look at the WAN health check rather than only enabling or disabling the default route. Monitoring a reliable external IP can help confirm whether the Internet path is actually working, not just whether the gateway is reachable. Recursive routing with separate routing tables can also make the failover behavior more predictable. I’d also check the route distance and gateway-check settings so the inactive WAN route doesn’t become active unexpectedly.

Hello,

Thank you for your responses.

I found the problem.

I had a firewall rule that was blocking my traffic.

Thank you for your help.