Dynamic Failover on Cisco Routers
While it is possible to put two routes in place with the secondary having a higher metric, this may not always work. In the event of a failure that does not bring down the physical interface on the router the primary route is not removed. There is also the situation where the primary interface takes too long to change status. The way around these limitations is simple – IP SLA:
STEP 1. Configure an ip sla (previously known as Response Time Reporter – rtr) object pinging the next-hop router (172.16.0.1) on primary link (FastEthernet 0/0). The polling frequency you specify (in seconds) depends on the reliability requirements, but anything below a few seconds would place unnecessary burden on the next-hop router (as you might not be the only one tracking its availability). Threshold sets the rising threshold that generates a reaction event and stores history information for the Cisco IOS IP SLAs operation.
R1(config)#ip sla 1
R1(config-ip-sla)#icmp-echo 172.16.0.1 source-interface FastEthernet 0/0
R1(config-ip-sla-echo)#threshold 100
R1(config-ip-sla-echo)#timeout 200
R1(config-ip-sla-echo)#frequency 3
R1(config)#ip sla schedule 1 life forever start-time now
STEP 2. Create a track object monitoring the reachability of the SLA target. As you probably don’t want to respond to a single lost ICMP packet, you should use the delay option of the track object to specify how long the next-hop router should remain unreachable before it’s declared to be lost (the down delay should be approximately three times the SLA polling frequency and the up delay should be even longer).
R1(config)#track 1 ip sla 1 reachability
R1(config-track)#delay down 10 up 20
STEP 3. After configuring the track object, attach it to the primary static default route to ensure that the default route is removed if the next-hop router is not reachable.
R1(config)#ip route 0.0.0.0 0.0.0.0 FastEthernet 0/0 track 1
R1(config)#ip route 0.0.0.0 0.0.0.0 FastEthernet 0/1 10
Notes:
You cannot change the parameters of a SLA object once you’ve scheduled it. To change the target IP address, timeouts, threshold or polling frequency, you need to delete the SLA object and recreate it.
When calculating the up delay, remember that a router can temporarily respond to pings during the bootstrap process.



