417 Words. Plan about 1 minute(s) to read this.
This small lab uses IP SLA to track the reachability of a remote IP. That IP SLA event is associated with a tracked object. Then a static route can be conditionally inserted into the routing table, using the tracked object. If the object is “up”, then the static route should appear in the table. If the object is down, the static route will be withdrawn.
Just for fun, I added a couple tracked objects tied to a couple of static routes with different administrative distances.
You could test my scenario with this topology. The code for the exercise follows.
! Create an IP SLA object that pings host 10.1.12.2. The IP SLA
! event fires once a second, and considers 10.1.12.2 down if there
! is no response in 900ms. Start the IP SLA task immediately, and
! run it indefinitely. We’ll reference the IP SLA objects later in
! a tracking object.
type echo protocol ipIcmpEcho 10.1.12.2
rtr schedule 1 life forever start-time now
! Create a second IP SLA object.
type echo protocol ipIcmpEcho 10.1.13.3
rtr schedule 2 life forever start-time now
! Create tracking objects that reference the IP SLA objects we created
track 101 rtr 1 reachability
track 102 rtr 2 reachability
! Create 2 static routes with administrative distances of 10 & 15
! respectively. These static routes are tied to the tracking objects.
! If the tracked object is down, the static route will not be present
! in the RIB.
ip route 10.1.100.0 255.255.255.0 10.1.145.4 10 track 101
ip route 10.1.100.0 255.255.255.0 10.1.145.5 15 track 102
! The net result of this configuration is as follows:
! (1) If both 10.1.12.2 and 10.1.13.3 are “UP” as reported by IP SLA,
! then both static routes are eligible to go into the RIB. Since
! 10.1.100.0/24 -> 10.1.145.4 has a lower administrative distance
! it be present in the routing table.
! (2) If tracking object 101 goes down, 10.1.100.0/24 -> 10.1.145.4 will
! fall out of the table. Assuming tracked object 102 is still up,
! 10.1.100.0/24 -> 10.1.145.5 will now be in the table, but with an
! AD of 15 instead of 10
Test by downing interfaces on R2 and R3 one at a time, and monitor the effect on R1’s routing table.
Also see this cisco.com article “Configuring Reliable Static Routing Backup Using Object Tracking“.
about | subscribe | @ecbanks