Interface Tracking to Remove Static Route from Routing Table

In this blog post we'll see how to monitor an interface for its status based on which a static route can be tracked. The static route will be removed from routing table when the interface goes down


Create tracking object
RTR#conf t
RTR(config-track)# track 10 interface loopback 101 line-protocol
RTR(config-track)# delay down 5 up 10
RTR(config-track)# exit
In the above commands, delay indicates that the tracking will wait for 5 seconds after the interface goes down before updating the tracking status as down. And it will wait for 10 seconds after the interface comes up before making the tracking object as up.


Attach tracking object to static route that needs to be removed from routing table upon interface going down
RTR(config)# ip route 10.200.100.0 255.255.255.0 10.10.20.254 track 10
RTR(config)# exit
RTR# show track
Track 10
  Interface Loopback101 line-protocol
  Line protocol is Up
    1 change, last change 00:01:12
  Delay up 10 secs, down 5 secs
  Tracked by:
    Static IP Routing 0


Let's shut down the interface Loopback 101 and verify the tracking status
RTR#show track
Track 10
  Interface Loopback101 line-protocol
  Line protocol is Up, delayed Down (3 sec remaining) ((hw admin-down))
    1 change, last change 00:02:10
  Delay up 10 secs, down 5 secs
  Tracked by:
    Static IP Routing 0

RTR#show track
Track 10
  Interface Loopback101 line-protocol
  Line protocol is Down ((hw admin-down))
    2 changes, last change 00:00:06
  Delay up 10 secs, down 5 secs
  Tracked by:
    Static IP Routing

RTR#show ip route track-table
 ip route 10.200.100.0 255.255.255.0 10.10.20.254 track 10 state is [down]

After shutting down the interface, we can see that tracking object is visible as 'Down' and static route is removed from routing table.




Comments

Popular posts from this blog

Specifying SSH port in Ansible Inventory

Ansible-Playbook to display output of multiple show commands (using stdout_lines with Loop)

Filtering Routes in BGP using Route-maps and Prefix-list

Ansible Playbook for Network OS Upgrade with pre and post checks

VMware NSX Traffic Flow — East-West & North-South

Bypassing Proxy Server in Google Chrome

Export or Backup Azure Network Security Groups into CSV using PowerShell

Ansible-playbook for backing up running config of Cisco IOS