Track

A “track” is a feature used for tracking the status of an object, such as an interface or IP address, and taking action based on its state. The track feature is used with other features such as IP SLA and Routing protocols.

The purpose of the track feature is to provide a mechanism for the router to monitor the status of a tracked object and to change the router’s behavior based on the state of that object. For example, a track can be configured to monitor the status of a specific interface. If the interface goes down, the track can be set up to trigger an action, such as changing the state of a route.

The track feature can also be used to monitor the state of an IP address. This is useful for failover scenarios where a backup device can take over the IP address of a primary device in case of failure. The track feature can be configured to monitor the primary device’s IP address, and if it becomes unreachable, the backup device can take over the IP address.

Defining a track

To define a track, an administrator can use the track command followed by a track number (between 1 and 1000), along with a specific condition to monitor, such as the reachability of an IP address or the status of an interface. The track can then be associated with a number of different actions.

Tracks are particularly useful in high availability environments, where administrators need to quickly detect and respond to changes in network conditions to maintain service uptime.

track (1-1000) interface IFNAME line-protocol

This command configures the router to track the line protocol status of a specified interface as an object with a specific number (between 1 and 1000).

Here’s what each option in the command does:

  • (1-1000): Specifies the number assigned to the tracked object. This number must be unique and between 1 and 1000.

  • IFNAME: Specifies the name of the interface to be tracked.

Example:

soodar(config)# track 1 interface ge2 line-protocol
track (1-1000) ip route A.B.C.D/M reachability [A.B.C.D|IFNAME] [vrf VRF]

Creates a tracking object that monitors the reachability of a specified IP address or network prefix. If the address or prefix becomes unreachable, the tracking object will transition to a “down” state.

Here’s what each option in the command does:

  • (1-1000): Specifies the number assigned to the tracked object. This number must be unique and between 1 and 1000.

  • A.B.C.D/M: This option is used to specify the network prefix to be tracked.

  • A.B.C.D | IFNAME: (Optional) Specifies the next-hop IP address or the outgoing interface that the device uses to reach the specified IP address or network.

  • VRF: (Optional) Specifies the VRF instance in which the tracked route is located. This option is only required if the device has multiple VRFs configured.

Example:

soodar(config)# track 10 ip route 10.1.1.1/32 reachability 10.1.1.1 vrf my_vrf

In this example, we’re creating a track object with ID 10 that will track the reachability of the IP address 10.1.1.1/32 via the interface associated with the IP address 10.1.1.1, in the VRF called my_vrf.

If the route to 10.1.1.1/32 becomes unreachable, the state of the track object will change to down. The state will change to up if the route becomes reachable again.

Note

Currently, the user can’t specify both the next-hop IP address and outgoing interface.

track (1-1000) ip sla (1-2147483647) <reachability|reaction <jitterAvg|jitterAvgPct|rtt|overThreshold|packetLoss|timeout> >
track (1-1000) list boolean <and|or>

The command configures a list of tracking objects and specifies the boolean operator (AND or OR) to evaluate their states.

Here is a breakdown of the command options:

  • (1-1000): Specifies the number assigned to the tracked object. This number must be unique and between 1 and 1000.

  • <and|or>: specifies the boolean operator to be used for the list evaluation

Example:

Suppose we have two tracked objects: object 1 and object 2. Object 1 tracks the reachability of a specific IP address, while object 2 tracks the state of a particular interface. We want to create a third tracked object that will be up only if object 1 and object 2 are up. To achieve this, we can use the following command:

soodar(config)# track 3 list boolean and
soodar(config-track)# object 1
soodar(config-track)# object 2

In this example, track 3 creates a new tracked object with an ID of 3, and list boolean and specifies that this object will be up only if both object 1 and object 2 are up. Finally, we add object 1 and object 2 to the list of tracked objects for track 3.

Using a track

Tracks can be used to dynamically install/uninstall static routes and quality of service (QoS). By using tracks, network administrators can build more resilient networks that can automatically adapt to changes in the network environment.

Routes with track

The ip route track command is used to create a static route that depends on the state of a tracked object.

Example:

In this example, the router is configured to track the reachability of IP SLA operation 1. The default gateway for the router is set to 192.168.1.1 and the route is tracked with track 1. If the IP SLA operation fails, the track will go down and the route will be removed from the routing table.

soodar(config)# ip sla 1
soodar(config-ip-sla)# icmp-echo 192.168.1.1
soodar(config)# ip sla schedule 1 start-time now
soodar(config)# track 1 ip sla 1 reachability
soodar(config)# ip route 0.0.0.0/0 192.168.1.1 track 1

Service policy with track

Example:

Let’s say we have a router connecting Network A( 192.168.1.0/24) and Network B( 192.168.2.0/24).

We want to apply a QoS policy to traffic that is leaving the router’s interface towards Network B, but only if the interface towards Network A is up and reachable.

First, we would create a track object to track the state of the interface towards Network A:

soodar(config)# track 1 interface ge1 line-protocol

This track object will track the state of the ge1 interface, and will become “up” if the interface’s line protocol is up.

Next, we would create a QoS policy map that defines the actions to take on the traffic:

soodar(config)# class-map c1
soodar(config-cmap)# match any
soodar(config)# policy-map p1
soodar(config-pmap)# class c1
soodar(config-pmap-c)# police 100k

In this example, we’re limiting the available bandwidth to 100Kbps for the traffic that matches the “c1” class.

Finally, we would apply the policy map to the outgoing interface towards Network B, and specify the track object that we created earlier

soodar(config)# interface ge2
soodar(config)# service-policy output p1 track 1

Troubleshooting

To troubleshoot tracking, it is important to first ensure that the objects being tracked are functioning properly. This can involve checking the status of interfaces, verifying that IP SLA probes are running and reporting accurate results, and confirming that the routing table is correct and up-to-date.

If the objects being tracked are functioning properly, the next step is to check the tracking configuration itself. This involves verifying that the correct objects are being tracked and that the tracking configuration is properly configured with the correct parameters.

Debugging commands, such as “debug track event” and “debug ip sla event,” can be used to view real-time information about the tracking status and to help identify any issues with the tracking configuration or the objects being tracked.

show track [(1-1000)] [json]

The show track command is used to display the current state of the configured track objects. This command displays information about the objects and their corresponding status.

The parameters of this command are as follows:

  • (1-1000): (Optional) Specifies the track object ID to display information for. The ID can be any value between 1 and 1000.

  • json: (Optional) Displays the output in JSON format.

Example:

soodar# show track
Track 12
  IP SLA 12 reaction
  Reaction is Up
    1 change[s], last change 00:00:09
  Latest operation return code: OK
  Tracked by:
    Static IP Routing
    Track List 13
Track 13
  List boolean or
  List boolean OR is Down
    2 change[s], last change 00:00:08
    object 12 Up
  Tracked by:
    Static IP Routing
show ip route track-table

The command is used to display the route tracking information for IP routes. It displays the current status of IP route tracking in the router and shows which routes and tracking objects are being used. This command verifies that the route tracking configuration is working as intended.

Example:

soodar# show ip route track-table
ip route 2.0.0.0/8 200.1.2.2 100 track 12  state is [up]
debug track event

The command is used to display debugging messages related to track objects.