Inject default route into IGP based on IP SLA response
filed in Cisco Networking on Mar.01, 2010
Here’s a little trick I learned on how to inject a default route into the network only if the IP SLA probe comes back with a success response. IP SLA is a way to check reachability for a given router or layer 3 device.
Network Topology:
RouterA - RouterB - RouterC
First lets lets create an IP SLA to monitor RouterC from RouterA.
# ip sla monitor 1
# type echo protocol ipIcmpEcho 3.3.3.3
# timeout 2000
# frequency 5
# ip sla monitor schedule 1 life forever start-time now
Lets setup tracking for this IP SLA
# track 1 rtr 1
Now lets create a dummy route and make sure it is entered into the routing table if the IP SLA succeeds.
# ip route 12.12.12.12 255.255.255.255 null0 track 1
Lets create a prefix-list that matches this route
# ip prefix-list PR_CHECK_STATIC permit 12.12.12.12/32
Next we create a Route-map that looks for this static route in the routing table.
# route-map RM_CHECK_STATIC
# match ip address prefix-list PR_CHECK_STATIC
Lastly we apply it to our IGP Router process and originate a default route
# default-information originate route-map RM_CHECK_STATIC
Done!
Basically, if the IP SLA fails, then the route is never entered into the routing tables which causes the route-map to fail with the prefix lookup and the end result being that no default route is advertised into the network.

