Community discussions

MikroTik App
Member Candidate
Member Candidate
Topic Author
Posts: 123
Joined: Sat Nov 30, 2013 7:49 am

failover not working if WAN1 is up

Fri Dec 06, 2013 4:45 am

Hi all,
I followed this guide

Script 1 pings a remote host using WAN1 and then if it fails, it set the default route to 3 which makes the WAN2 the default route. It works fine.

However once the connection is back again on WAN1, it no longer detects it and it no longer switches back to WAN1. Can you help me diagnose the problem?
Any help would be appreciated. Thanks!
just joined
Posts: 8
Joined: Tue Dec 10, 2013 9:54 am

Re: failover not working if WAN1 is up

Tue Dec 10, 2013 2:20 pm

this is ours netwatch script that we are using:

and of course we are pinging in 10sec interval with timeout 10sec

:local i 0; {:do {:set i ($i + 1)} while (($i < 5) && ([/ping interval=3 count=1]=1))};
:if ($i=5) do={:log info "PRIMARY LINK UP";
/ip dhcp-client set default-route-distance=0 numbers=0}
:local i 0; {:do {:set i ($i + 1)} while (($i < 5) && ([/ping interval=3 count=1]=0))};
:if ($i=5) do={:log info "PRIMARY LINK DOWN";
/ip dhcp-client set default-route-distance=3 numbers=0}
and monitor route in routes set

dst address to gateway through "primary" link. So the ping to will go always through wan1 interface , and cannot go through wan2. So when wan1 is up it will ping and therefore will be up and set route distance to 0.

numbers=0 is for "1st" dhcp client , you can see the number if you go to /ip dhcp-client print you will see the number under #

Who is online

Users browsing this forum: No registered users and 77 guests