Create a SLA object to schedule a ping test
ip sla 1
icmp-echo <ip address>
frequency <in seconds>
ip sla schedule 1 life forever start-time now
Enable Enhanced Object tracking on the SLA
track 1 ip sla 1 reachability
Tie the tracked object to a static route
ip route 150.1.1.0 255.255.255.0 155.1.146.1 track 1
As soon as the ping test fails the static route will be removed from the routing table.
When there is another static route with a higher Administrative Distance this route will be injected into the routing table.
Once the ping test is successfull again the original static route will be injected again.
Usefull show commands:
#sh track 1
Track 1
IP SLA 1 reachability
Reachability is Up
3 changes, last change 00:21:42
Latest operation return code: OK
Latest RTT (millisecs) 1
Tracked by:
STATIC-IP-ROUTING 0
#sh ip sla statistics 1
IPSLAs Latest Operation Statistics
IPSLA operation id: 1
Type of operation: icmp-echo
Latest RTT: 1 milliseconds
Latest operation start time: *20:39:26.283 UTC Wed Jul 13 2011
Latest operation return code: OK
Number of successes: 417
Number of failures: 13
Operation time to live: Forever
Usefull debug commands:
#debug track
#debug ip routing