Reporting a state of an IP route

Have you ever wanted to be notified when your router loses a specific route (for example, the default route toward the Internet)? In IOS release 12.4T you can do it with a combination of Enhanced Object Tracking and Embedded Event Manager 2.2. As the first step, you configure a track object that will monitor the state of an IP route with the track ip route command.
track 100 ip route 0.0.0.0 0.0.0.0 reachability
After the track object has been created, you can monitor its state with an EEM applet (in the configuration example it only generates a syslog message, but you could also send an email to the network administrator).
event manager applet TrackRoute_0.0.0.0
event track 100 state any
action 1.0 syslog msg "route is $_track_state"
And now a test run ...
a1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
a1(config)#ip route 0.0.0.0 0.0.0.0 loopback 0
a1(config)#^Z
01:08:47: %SYS-5-CONFIG_I: Configured from console by console
01:08:51: %HA_EM-6-LOG: TrackRoute_0.0.0.0: route is up
a1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
a1(config)#interface loopback 0
a1(config-if)#shutdown
01:09:10: %SYS-5-CONFIG_I: Configured from console by console
01:09:11: %LINK-5-CHANGED: Interface Loopback0, changed state to administratively down
01:09:21: %HA_EM-6-LOG: TrackRoute_0.0.0.0: route is down
As you can see from the example, there is a significant delay before the track object responds to a route change. You can adjust this delay with the track timer ip route seconds global configuration command (default is 15 seconds).

11 comments:

  1. Hi Ivan.

    Nice example!

    Is this possible through MPLS to? You shutdown a local interface, what if the routing beetween sites a down?

    /Kenny
  2. What do you mean with "MPLS"?
  3. Hi

    I want to track a BGP route in the routing table of a 6500 switch.Once I recieve that route I want to shut my interface vlan (SVI) on the 6500 switch .Is this possible?

    Thanks
  4. With EEM3.0 (probably not available on a 6500 image) you can track routes per-protocol (so it would be possible to track a BGP route). With the track command you can only track the presence of an IP prefix in the IP routing table.
  5. Hi

    My scenario is that I have got a directly connected network to a 6500 switch.This switch has got a BGP relationship with another peer.If I start recieiving a BGP advertisement for the directly conected route from the peer I want to shut down the interface vlan SVI for the directly connected network.Since the route will not get installed in the routing table till a directly connected network is present.I will be tracking another route based on which I want to trigger this action.

    Thanks
  6. You could also track the state of the BGP neighbor (but then obviously you have to be sure the BGP neighbor will send the desired prefix). Would you be willing to share more information with me (your problem fits pretty nicely into a "real-life example" I was looking for)? If so, it would be best to send me an e-mail (the instructions are available through the "Contact me" link at the top of the page)
  7. Hi

    I have sent you an Email with the details of the scenario.

    Thanks
  8. Hi
    The folowing cisco link states that in new 6500 image SXI EEM 2.4 is supported with Enahnced object tracking:

    http://www.cisco.com/en/US/prod/collateral/iosswrel/ps8802/ps6970/ps6017/ps9673/product_bulletin_c25-503086.html

    Thanks
  9. Could this also be used with HSRP to track the presence of a default route learned from separate ISPs and then change states?
  10. Of course. Every feature that uses a track object can use this.
  11. Thanks for the quick reply!
Add comment
Sidebar