Community discussions

MikroTik App
 
nerdtron
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 http://wiki.mikrotik.com/wiki/Improved_Netwatch_II

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!
 
samuellsk
newbie
Posts: 30
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 8.8.8.8 in 10sec interval with timeout 10sec

UP:
:local i 0; {:do {:set i ($i + 1)} while (($i < 5) && ([/ping 8.8.8.8 interval=3 count=1]=1))};
:if ($i=5) do={:log info "PRIMARY LINK UP";
/ip dhcp-client set default-route-distance=0 numbers=0}
DOWN:
:local i 0; {:do {:set i ($i + 1)} while (($i < 5) && ([/ping 8.8.8.8 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 8.8.8.8 gateway through "primary" link. So the ping to 8.8.8.8 will go always through wan1 interface , and cannot go through wan2. So when wan1 is up it will ping 8.8.8.8 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: antonsb, jaisal, Tony93, vagrik and 208 guests