For example I am unfamiliar with IP Route Set?
“Set” is CLI Command that lets you set (or change) a parameters value. In this case we are setting distance=3 for IP>Route>the route with WAN1 in comments.
How does distance=3 have to do with anything
Serves the same purpose as the distance settings that you provided. Routes with equal destination are next determined to be active by the lower distance. Changing WAN1 distance from 1 to 3 makes WAN2 distance now the lower distance and it will now be the active route. If you were to simply disable the route, the netwatch could never determine if 8.8.8.8 is available again and return WAN1 to be active.
what is the function of /r/
The "" (\ = line break) and "\r" (\r\ = return) are extra annotation created by /export.
up=
/ip route set [find where comment="WAN1"] distance=1;
:log warning "WAN1 restored"
down=
/ip route set [find where comment="WAN1"] distance=3;
:log warning "WAN1 down, switching to WAN2"
the script solution does nothing to check availability of WAN2.
For a simple failover, does it really matter is WAN2 availability is checked. If they are both down you have, you still will not have Internet. If you wanted to log that they are both down or need something else to happen, a second netwatch for WAN2 would be in order.
Finally, 2 frogs can you add in the second host as I am paranoid that google is sometimes down too and want to have an open dns server checked as well. 208.67.220.220
change the down script to:
:if ([/ping 208.67.220.220 count=5] = 0) do={/ip route set [find where comment="WAN1"] distance=3;
:log warning "WAN1 down, switching to WAN2"}
This may not be best as the scripts only get run once on down or up… writing a script for scheduler to check multiple IP’s would be best.