Route Failover using IP SLA
Using IP SLA to change a static or default route depending on reachability.
Here's the scenario, Traffic to the internet should usually flow through ISP A, but if something happens within that ISP's network (or to a different downstream router), and you only have a static or default route to them , but the physical link stays up, then you want the router to automatically install a different static or default route pointing to ISP B instead.
First, configure 2 default (or static) routes
Give the secondary route a higher AD and configure the primary to track IP SLA
ip route 0.0.0.0 0.0.0.0 10.10.10.1 track 10
ip route 0.0.0.0 0.0.0.0 20.20.20.1 123
Now configure IP SLA.
We're going to ping an IP address on the internet, or another downstream router, and if it becomes unreachable, then we want the router to remove the primary default-route and install the secondary pointing to the other ISP
ip sla 10
icmp-echo 8.8.8.8 source-interface vlan 10
threshold 2
timeout 10000
frequency 10
Threshold, timeout, and frequency can all be adjusted depending on how often to ping, how long before primary route is dropped, how many are dropped, etc...
Now turn on IP SLA on the router
ip sla schedule 10 life forever start-time now
I have also found that some platforms need the following command in order to connect IP SLA to the routing process, but it may not always be necessary:
track 10 ip sla 10
Here's the scenario, Traffic to the internet should usually flow through ISP A, but if something happens within that ISP's network (or to a different downstream router), and you only have a static or default route to them , but the physical link stays up, then you want the router to automatically install a different static or default route pointing to ISP B instead.
First, configure 2 default (or static) routes
Give the secondary route a higher AD and configure the primary to track IP SLA
ip route 0.0.0.0 0.0.0.0 10.10.10.1 track 10
ip route 0.0.0.0 0.0.0.0 20.20.20.1 123
Now configure IP SLA.
We're going to ping an IP address on the internet, or another downstream router, and if it becomes unreachable, then we want the router to remove the primary default-route and install the secondary pointing to the other ISP
ip sla 10
icmp-echo 8.8.8.8 source-interface vlan 10
threshold 2
timeout 10000
frequency 10
Threshold, timeout, and frequency can all be adjusted depending on how often to ping, how long before primary route is dropped, how many are dropped, etc...
Now turn on IP SLA on the router
ip sla schedule 10 life forever start-time now
I have also found that some platforms need the following command in order to connect IP SLA to the routing process, but it may not always be necessary:
track 10 ip sla 10