Route selection by host reachability with Cisco SLA
Posted by Al Banks in Cisco router
Cisco’s SLA features, available in IOS other than IP Base, allow modification of the routing table based on a monitored item. In this example, we’ll monitor an Internet address, and change the default route if that address is unreachable.
In this example, I’ll use 4.4.4.4 as the remote ip address. FE0/0 goes to the primary provider, FE0/1 goes to a backup connection. FE 0/0 is 1.1.1.1/29 (gw 1.1.1.2), FE 0/1 is 2.2.2.1, (gw 2.2.2.2)
First, we need to make sure the ping to 4.4.4.4 goes out FE0/0 – otherwise, this may bounce around as the address becomes available over the redundant link.
ip route 4.4.4.4 255.255.255.255 1.1.1.2
Now, let’s set up our SLA. icmp-echo establishes ping, and the schedule line tells the router to run this forever. There are other methods available, too.
ip sla 1
icmp-echo 4.4.4.4
ip sla schedule 1 life forever start-time now
Let’s be sure it’s running:
router#sh ip sla statistics
IPSLAs Latest Operation Statistics
IPSLA operation id: 1
Latest RTT: 1 milliseconds
Latest operation start time: *16:00:53.925 UTC Tue Jan 27 2009
Latest operation return code: OK
Number of successes: 33
Number of failures: 0
Operation time to live: Forever
Now that we’re SLA monitoring this address, what do we do with this information? Track is used to make things happen!
track 1 ip sla 1 reachability
While we’re at it, let’s look at the track status:
router#sh track 1
Track 1
IP SLA 1 reachability
Reachability is Up
1 change, last change 11:14:51
Latest operation return code: OK
Latest RTT (millisecs) 1
Tracked by:
Lastly, let’s set our routes to use the track:
ip route 0.0.0.0 0.0.0.0 1.1.1.2 track 1
ip route 0.0.0.0 0.0.0.0 2.2.2.2 200
The first route will vary with the track state, the second is weighted so it won’t normally be used.
The Conversation
Follow the reactions below and share your own thoughts.
February 07, 2009 at 11:45 pm, mramadan said:
thanks
October 30, 2009 at 8:31 am, BLP said:
Great! Thank you!
February 26, 2010 at 10:21 am, sanjay said:
Nice explanation
March 16, 2010 at 2:25 pm, Anonymous said:
thankss..very useful for my knowledge
September 11, 2010 at 12:20 am, Woodlander said:
Thank you. The example clarifies the concept well.
October 06, 2011 at 4:13 pm, Sjaak de Vries said:
Hi, thanks for this article. I had to make a few minor adjustments to get this running on a C3550 w/ c3550-ipservicesk9-mz.122-44.SE6. I had to use “track 1 rtr 1 reachability”, so not the “ip sla” part. Now it works like a charm
February 28, 2012 at 1:08 am, ivica said:
very nice, short but clear