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

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

Ansible-playbook for backing up running config of Cisco IOS

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

Export or Backup Azure Virtual Networks or Subnet information into CSV using PowerShell

Ansible Playbook for Network OS Upgrade with pre and post checks

Export or Backup Azure Route Table into CSV using PowerShell

Cisco ASA Active/Active Failover Configuration

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

Get Model Number and Serial number of Cisco devices using ios_facts module

Download Visio Stencils for Network Topology