Yes - disconnecting the WAN cable will force the failover.
But I wanted to be able to do this remotely / manually from a terminal prompt if possible. However, I wanted to force fast switchovers such that I didn't need to wait for an interface to re-auth / re-acquire an IP address everytime.
I tried to play with the routing rules manually from within the ssh prompt, but I couldn't create 2 routes with different metrics, and drop the lower one. Everytime I tried, the system would automatically recreate the route for the default WAN connection.
For example:
Code:
admin@RT-AC1900P-1D90:/tmp/home/root# route add default gw 20.248.155.139 dev ppp0 metric 10
admin@RT-AC1900P-1D90:/tmp/home/root# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
13.19.179.130 24.20.158.1 255.255.255.255 UGH 0 0 0 vlan3
24.20.158.1 0.0.0.0 255.255.255.255 UH 0 0 0 vlan3
20.248.155.139 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 br0
10.34.72.0 0.0.0.0 255.255.255.0 U 0 0 0 tun13
10.8.0.0 0.0.0.0 255.255.255.0 U 0 0 0 tun21
24.20.158.0 0.0.0.0 255.255.255.0 U 0 0 0 vlan3
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 vlan2
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 24.20.158.1 0.0.0.0 UG 0 0 0 vlan3
0.0.0.0 20.248.155.139 0.0.0.0 UG 10 0 0 ppp0
So, in this case, I've set up a spare default route to `ppp0` with a higher metric (10). When I wanted to test out that connection, I tried to delete the default route to `vlan3`, however, the router automatically recreates it everytime.
Code:
admin@RT-AC1900P-1D90:/tmp/home/root# route del default gw 24.20.158.1 dev vlan3
admin@RT-AC1900P-1D90:/tmp/home/root# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
134.19.179.130 24.20.158.1 255.255.255.255 UGH 0 0 0 vlan3
24.20.158.1 0.0.0.0 255.255.255.255 UH 0 0 0 vlan3
20.248.155.139 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 br0
10.34.72.0 0.0.0.0 255.255.255.0 U 0 0 0 tun13
10.8.0.0 0.0.0.0 255.255.255.0 U 0 0 0 tun21
24.20.158.0 0.0.0.0 255.255.255.0 U 0 0 0 vlan3
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 vlan2
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 20.248.155.139 0.0.0.0 UG 10 0 0 ppp0
admin@RT-AC1900P-1D90:/tmp/home/root# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: seq=0 ttl=119 time=10.532 ms
^C
--- 8.8.8.8 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 8.999/9.765/10.532 ms
admin@RT-AC1900P-1D90:/tmp/home/root# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
134.19.179.130 24.20.158.1 255.255.255.255 UGH 0 0 0 vlan3
24.20.158.1 0.0.0.0 255.255.255.255 UH 0 0 0 vlan3
20.248.155.139 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 br0
10.34.72.0 0.0.0.0 255.255.255.0 U 0 0 0 tun13
10.8.0.0 0.0.0.0 255.255.255.0 U 0 0 0 tun21
24.20.158.0 0.0.0.0 255.255.255.0 U 0 0 0 vlan3
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 vlan2
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 24.20.158.1 0.0.0.0 UG 0 0 0 vlan3
0.0.0.0 20.248.155.139 0.0.0.0 UG 10 0 0 ppp0
Thanks,
Eric