I have the following scenario:
Internet <> DSL <> DSLMODEM WAN | (DSLMODEM LAN <> ROUTER)
The DSLModem LAN side is a public subnet. My router is on the same network segment and the gateway is the DSL modem.
Here is the problem, if I use ‘check gateway = ping’ on this interface, it doesn’t do anything when the DSL goes down, because the gateway’s address is still up on the local network segment! Ouch.
Does anyone have a method to ‘check gateway’ but to ping an address farther away? Maybe even ping the provider’s DNS server or other static device?
Thanks in advance.
Write a script or use Netwatch are your two options currently with a single internet connection.
Here is what I did.
#Picked 2 somewhat reliable public IPs and set a static routes to each, 1 through each gateway
DST-ADDRESS PREF-SRC GATEWAY DISTANCE
3 A S 4.2.2.1/32 DSL_IP DSL_GATEWAY 1
4 A S 4.2.2.2/32 EFM_IP EFM_GATEWAY 1
#netwatch ping these hosts at 5 second intervals
HOST TIMEOUT INTERVAL STATUS SINCE
0 4.2.2.1 500ms 5s up jun/07/2012 15:20:58
1 4.2.2.2 500ms 5s up jun/07/2012 15:20:55
#change the distance of the route depending on netwatch's results.
0 HOST UP:
/ip route set [/ip route find where comment="DSL"] distance=1
0 HOST DOWN:
/ip route set [/ip route find where comment="DSL"] distance=51
1 HOST UP:
/ip route set [/ip route find where comment="EFM"] distance=2
1 HOST DOWN:
/ip route set [/ip route find where comment="EFM"] distance=52
I decided that I didn't want to disable the interface because it might just be that these two DNS servers are down so I just stretched the distance of the route out so if they both 'went down', then the connection might still stay up.
I will probably change the dst addresses to something on my providers network, but I am going to run a traceroute on a timer for a few weeks and see if I can identify the IP of their core router or something that must be up for me to get service.