Community discussions

 
4ikotillo
just joined
Topic Author
Posts: 1
Joined: Wed Oct 22, 2014 3:25 pm

3 WAN check script

Wed Nov 14, 2018 10:10 am

I have 3 WAN. And i have mangle rules for balancing traffic. I wrote scripts to check the WANs, but they do not work correctly. Tell me where I made a mistake? This is a script to check first and therd WANs in NetWatch if second WAN DOWN:
:local W1IP [/ping 208.67.220.220 count=5]

:local W3IP [/ping 1.1.1.1 count=5]

:if (W1IP = 0) do={

:if (W3IP = 0) do={
/system script run [find name="DISABLE_ALL"]
:log warning "ALL WANS IS DOWN! DISABLE ALL MANGLE!"

} else={
/system script run [find name="all_to_WAN3"]
:log warning "WAN1 AND WAN2 IS DOWN! ALL SWICHED TO WAN3!"

}

} else={
:if (W3IP = 0) do={
/system script run [find name="all_to_WAN1"]

:log warning "WAN2 AND WAN3 IS DOWN! ALL SWICHED TO WAN1!"

} else={
/system script run [find name="only_WAN1_and_WAN3"]
:log warning "WAN2 IS DOWN! ALL SWICHED TO WAN1 AND WAN3!"

}

}

If the second and third channels are off, the script does not display a message "WAN2 AND WAN3 IS DOWN! ALL SWICHED TO WAN1!". It continues to work and displays messages - "WAN2 IS DOWN! ALL SWICHED TO WAN1 AND WAN3!". I use addresses to check WAN availability:
1WAN - 208.67.220.220
2WAN - 208.67.220.222
3WAN - 1.1.1.1

Who is online

Users browsing this forum: MSN [Bot] and 10 guests