I checked the forum and wiki , i found examples to make a routing failover , but all of them was depending on the gateway failure ...
In fact the gateway successfull response doesnt mean that there is a public internet connection , cause for example in Vsat systems the gateway is a router located in the same vsat location , othere isp's gateways are located in the same city ( most of the cases ) , so we need to test an IP which is beyond the local IP's .. to make sure that the public internet connection is really exist or its dropped ..
thats why i made this , tested it successfully , i'll post it here cause i need to be sure of what i did , and to let friends improve it ..
gateway1 = 192.168.1.1
gateway2 = 192.168.2.1
we have an enabled gateway gw1= 192.168.1.1 , gw2 is disabled , the last line is to testing gw1 , assuming gw1 is the prefered gateway , testing will depend on a public ip address which is not usually used by you or by any one of your clients , as you see i choose 4.2.2.3 , so this ip will not be reached but from gw1 ..
/tool netwatch
add comment="" disabled=no down-script="/ip route set [find comment="gw1"] disabled=yes\r
\n/ip route set [find comment="gw2"] disabled=no\r
\n" host=4.2.2.3 interval=15s timeout=480ms up-script=
"/ip route set [find comment="gw1"] disabled=no\r
\n/ip route set [find comment="gw2"] disabled=yes"
netwatch tool will ping to 4.2.23 every 15 second if reply then the gw1 is enabled and gw2 is disabled , if timeout gw1 will be disabled and gw2 will be enabled , after 15 second this will be repeated ...
this was tested in 3 systems and succeded , any suggestion or corrections ?
well i really didnt see it in search , maybe cause i was searching for failover !!!
anyway , it has similar idea , about pinging an internet public IP .. but its different in treatment ..
i tried your example , when i put
add gateway=213.180.204.3 routing-mark=ISP1 scope=30 target-scope=30 check-gateway=ping
i got ( unreachable ) !!!
hi forum, this is my first post, although I have been reading the forum on several topics for many months now…
I have been researching on the most effective way to implement a simple failover solution between 2 ISP connections and found this one the best… It’s simple (no routing marks, no scripts) AND it reverts back to the main connection as soon as it’s available!
I’ve set up my system the same way as samsoft08’s, but if I disconnect cable from prefered gateway port, netwatch starts switching gateways up and down every “interval” seconds (in my case it’s 30). When I connect the cable, it switches the prefered gateway back up and stays in this state until the next disconnect.
3 A S ;;; Test Google
dst-address=173.194.35.216/32 pref-src=109.68.189.68
gateway=ether1-gateway gateway-status=ether1-gateway reachable
distance=1 scope=30 target-scope=10
try
3 A S ;;; Test Google
dst-address=173.194.35.216/32 pref-src=109.68.189.68
gateway=109.68.189.65 gateway-status=109.68.189.65 reachable
distance=1 scope=30 target-scope=10
Changing test gateway settings didn’t help. It didn’t block pinging Google from ether2-gateway, that was the problem. As soon as I recognized this, I just added the firewall rule: