You can configure tracks with the action command to enable Enhanced Object Tracking. As a prerequisite, configure the track type that is to be tracked.
The following example shows how to configure the action command on a track based on the change in state of the track:
/* Configure track1 to track line-protocol state of the interface FourHundredGigE0/0/0/1 */
Router#configure
Router(config)#track track1
Router(config-track)#type line-protocol state
Router(config-track-line-prot)#interface FourHundredGigE0/0/0/1
Router(config-track-line-prot)#exit
Router(config-track)#exit
/* Configure track2 to track line-protocol state of the interface FourHundredGigE0/1/0/1 */
Router(config)#track track2
Router(config-track)#type line-protocol state
Router(config-track-line-prot)#interface FourHundredGigE0/1/0/1
Router(config-track-line-prot)#exit
Router(config-track)#exit
/* Configure track3 with boolean AND of track1 state and track2 state. Specify actions to take when track3 state changes. */
Router(config)#track track3
Router(config-track)#type list boolean and
Router(config-track-list-boolean)#object track1
Router(config-track-list-boolean)#object track2
Router(config-track-line-boolean)#exit
Router(config-track)#action
Router(config-track-action)#track-down error-disable interface FourHundredGigE0/0/0/0 auto-recover
Router(config-track-action)#track-down error-disable interface FourHundredGigE0/1/0/0
The following running configuration example shows you how to configure the action command for the scenario described in Figure 1.
track track1
type line-protocol state
interface FourHundredGigE0/0/0/1
!
!
track track2
type line-protocol state
interface FourHundredGigE0/1/0/1
!
!
track track3
type list boolean and
object track1
object track2
!
action
track-down error-disable interface FourHundredGigE0/0/0/0 auto-recover
track-down error-disable interface FourHundredGigE0/1/0/0
Verification
To view the state of the track, use the show track command. Initially, all tracked interfaces are up.
Router#show track
Track track3
List boolean and is UP
7 changes, last change 16:04:28 IST Mon Jul 02 2018
object track2 UP
object track1 UP
Track track1
Interface FourHundredGigE0/0/0/1 line-protocol
Line protocol is UP
7 changes, last change 16:04:28 IST Mon Jul 02 2018
Track track2
Interface FourHundredGigE0/1/0/1 line-protocol
Line protocol is UP
7 changes, last change 16:02:41 IST Mon Jul 02 2018
To verify if the interface configured for tracking is error-disabled, use the show error-disable command. As all track states are up, there are no error-disabled interfaces.
Router#show error-disable
Interface Error-Disable reason Retry (s) Time disabled
------------------- ------------------------------ --------- ---------------
There are no interfaces error-disabled matching the given criteria
To view the status of all the interfaces of the tracked object, use the show ipv4 interface brief command.
Router#show ipv4 interface brief
Interface IP-Address Status Protocol Vrf-Name
FourHundredGigE0/0/0/0 unassigned Up Up default
FourHundredGigE0/0/0/1 unassigned Up Up default
FourHundredGigE0/1/0/0 unassigned Up Up default
FourHundredGigE0/1/0/1 unassigned Up Up default
When a track state becomes down, the corresponding track action happens and the status of the interfaces configured in the
action changes. The state of track3 becomes "down" when either track1 state or track2 state becomes "down". The following
show error-disable command displays the corresponding output.
Router#show error-disable
Interface Error-Disable reason Retry (s) Time disabled
------------------- ------------------------------ --------- ---------------
FH0/0/0/0 ot-track-state-change --- 08:42:08
FH0/1/0/0 ot-track-state-change --- 08:42:01
When the state of track3 is "down", the show ipv4 interface brief command displays the following output.
Router#show ipv4 interface brief
Interface IP-Address Status Protocol Vrf-Name
FourHundredGigE0/0/0/0 unassigned Shutdown Down default
FourHundredGigE0/0/0/1 unassigned Shutdown Down default
FourHundredGigE0/1/0/0 unassigned Shutdown Down default
FourHundredGigE0/1/0/1 unassigned Up Up default
When track3 recovers, the Shutdown status on the interface FourHundredGigE0/0/0/0 clears. This is because of the auto-recover configuration for FourHundredGigE0/0/0/0. However, interface FourHundredGigE0/1/0/0 remains in the Shutdown status because
auto-recover isn't configured on this interface.
The change reflects in the output of the show ipv4 interface brief command.
RP/0/0/CPU0:ios#show ipv4 interface brief
Interface IP-Address Status Protocol Vrf-Name
FourHundredGigE0/0/0/0 unassigned Up Up default
FourHundredGigE0/0/0/1 unassigned Up Up default
FourHundredGigE0/1/0/0 unassigned Shutdown Down default
FourHundredGigE0/1/0/1 unassigned Up Up default