Route selection by host reachability with Cisco SLA

Contributor Icon Contributed by Al Banks  
Tag Icon Tagged: 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.

 

6 Comments -


  1. mramadan said on February 7, 2009

    thanks

  2. BLP said on October 30, 2009

    Great! Thank you!

  3. sanjay said on February 26, 2010

    Nice explanation

  4. Anonymous said on March 16, 2010

    thankss..very useful for my knowledge

  5. Woodlander said on September 11, 2010

    Thank you. The example clarifies the concept well.

  6. Sjaak de Vries said on October 6, 2011

    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 :)

 

RSS feed for comments on this post. TrackBack URL

Leave a comment -