Failover alternatives to check-gateway=ping

I have two WAN connections: The primary is a cable connection configured with DHCP Client, and the secondary is ADSL configured with PPPoE Client. I set up identical routing rules, with check-gateway=ping on the rule for the primary connection and distance=2 for the secondary, but it doesn’t properly detect the gateway going down. Pinging the gateway from the CLI will time out, but yet it keeps trying to route traffic through the primary connection.

So, I’m looking for an alternative failover script to use. I came across this: http://wiki.mikrotik.com/wiki/ECMP_Failover_Script and tried to adapt it, but I didn’t have any luck getting netwatch to actually disable the primary gateway. That script would be perfect, except I don’t want to load balance, I just need simple failover. Can anyone help?

Anyone?

Let us see the output of the following commands

ip route pr



ip route rule pr
[pacmanfan@MikroTik] > ip route pr
Flags: X - disabled, A - active, D - dynamic, C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme, 
B - blackhole, U - unreachable, P - prohibit 
 #      DST-ADDRESS        PREF-SRC        GATEWAY-STATE GATEWAY                         DISTANCE INTERFACE                
 0 A S  ;;; centurytel
        0.0.0.0/0                          reachable     centurytel                      2        centurytel               
 1   S  0.0.0.0/0                          unreachable   cable                           1        cable                    
 2 ADC  10.11.192.0/24     10.11.192.1                                                   0        lan                      
 3 ADC  10.11.192.122/32   10.11.192.1                                                   0        <pppoe-user1>         
 4 ADC  10.11.192.123/32   10.11.192.1                                                   0        <pppoe-user3>     
 5 ADC  10.11.192.124/32   10.11.192.1                                                   0        <pppoe-user4>          
 6 ADC  10.11.192.125/32   10.11.192.1                                                   0        <pppoe-user2>         
 7 ADC  72.161.16.1/32     72.161.16.35                                                  0        centurytel



[pacmanfan@MikroTik] > ip route rule pr
Flags: X - disabled, I - inactive 
 0   src-address=0.0.0.0/0 dst-address=0.0.0.0/0 action=lookup table=main

Note that the cable interface is currently disabled, which is why the gateway state is unreachable. The problem is when the cable gateway goes down while there’s still a DHCP lease–it doesn’t go into “unreachable” state.

why is the gateway field blank, meaning no next-hop? What IP can it ping ?

The gateway field is blank on the two static routes because I’m using gateway-interface. In Winbox, my static routes are configured like this:

#1
Destination: 0.0.0.0/0
Gateway Interface: cable
Check Gateway: ping
Type: unicast
Distance: 1
Scope: 30
Target Scope: 10

#2
Destination: 0.0.0.0/0
Gateway Interface: centurytel
Type: unicast
Distance: 2
Scope: 30
Target Scope: 10

I don’t have a gateway assigned to the routes because they’re assigned to my WAN interfaces by DHCP and PPPoE. That’s why I’m using gateway interface on the routes. When the primary cable modem goes down, manual pings to the cable interface gateway time out, but route #1 using gateway-interface=cable stays active, instead of switching over to route #2.

i dont think check-gateway will work without an IP address. There is nothing for it to ping. Any specific reason you have to use the interface-name rather than the IP for the next-hop ? Either way, it sounds like you need to setup your own failover script / netwatch rather than use check-gateway. Check-gateway=arp might work in your case, not sure.

Now I’m using a gateway IP on route #1, and gateway-state goes to unreachable whenever I disconnect the cable modem, but route #1 still stays active! It won’t switch over to using route #2.

How can I use netwatch to set up my own script? I’ll gladly pay $50USD for one that works! :slight_smile:

help needed

i have a root like this
2 A S dst-address=0.0.0.0/0 gateway=xxx.xxx.xxx.xxx,yyy.yyy.yyy.yyy gateway-status=xxx.xxx.xxx.xxx reachable ether3,yyy.yyy.yyy.yyy reachable ether1
check-gateway=ping distance=1 scope=30 target-scope=10

x and y

are the address of my dsl modem
if i enable this

check-gateway=ping distance=1 scope=30 target-scope=10

does it look for that ip address or google as the modem works fine but google goes down

how ping google and if google don resolve remove from routes?

any ideas to help fix this

running 4v