Using the Track Statement

Assume you have the following hypothetical scenario, R2 and R7 on one site, connected to a WAN infrastructure via multiple links (omitted here), where there are two gateways R5 & R6:


Client requests the following:

  • R2 should be the active HRSP router if R2 has connectivity to BOTH R5 and R6 loopbacks.
  • R7 should be the active HSRP router if R2 has connectivity to only ONE of the 2 gateways.
  • R2 should be the active HSRP router if R2 has NO connectivity to either R5 or R6.

The use of the track statements and a boolean expression, in conjunction with HSRP would suffice.

The first requirement is, if both and are in the routing table of  R2, then R2 should be Active. If one of these routes disappears, R7 should become Active, and lastly if both routes disappear, R2 should become Active again.

The first two are easy, with two track statements, Track1 for and Track2 for and correct decrement amounts. But the last poses more of a challenge.

By using the boolean ‘AND’ statement for both Track1 and Track2, you’ll have the third track to meet the requirements.

The config for these track statements are as follow:
track 1 ip route reachability
track 2 ip route reachability
track 3 list boolean and
object 1 not
object 2 not

Track1 would be ‘TRUE’ if is present in the routing table, ‘FALSE’ if non existent in the routing table. Same for Track2.

Track3 says if (Object1 = Track1 is not true, ie false) AND (Object2 = Track2 is not true), thus if both routes are not present in the routing table, then Track3 will be ‘TRUE’. If one or both of these router are present in the routing-table, Track3 is ‘FALSE’.

With HSRP’s decrements statements, if the Track status is TRUE/UP, no decrement action is necessary, but if the Track status is FALSE/DOWN, then the specified amount will be deducted from the configured priority amount on that interface.

The configuration on the Ethernet interfaces to complete this :

interface FastEthernet0/0
ip address
standby version 2
standby 27 ip
standby 27 priority 95
standby 27 preempt

interface FastEthernet1/0
ip address
standby version 2
standby 27 ip
standby 27 priority 150
standby 27 preempt
standby 27 track 1 decrement 10
standby 27 track 2 decrement 10
standby 27 track 3 decrement 50

R7 uses a priority of 95 and R2 uses a priority of 150. These values are based on the decrement values used by the track statements. Let me explain:

Firstly what does Track3 do again?

Track3 is UP if both Track1 and Track2 are DOWN! If Track3 is UP, the priority is not decremented by 50.

But Track3 will be DOWN if either, or both Track1 and/or Track2 are UP. If Track3 is DOWN the priority is decremented by 50, to have a HSRP priority of 100, under normal circumstances. With a priority of 100 R2 will be the Active HSRP router, since R7 has a priority of 95. Biggest priority always wins.

But if Track1 goes to a DOWN state (ie removed from the routing table), the priority of 100 is decremented by 10 to 90. This will make R7 the Active HSRP router since R7 now has the highest priority with 95.

If in addition, disappears from the routing table, Track2 will also go DOWN, along with Track1, then only will Track3 kick in. (If Track1 & Track2 = DOWN, then Track3 is UP). The priority (100) on the interface of R2 will be increased with 50, to 150, but be decremented by 2x 10 for Track1 and Track2. This will give Router2 a interface priority of 130, thus higher than Router7’s 95, and become Active again.

Lets see this on the CLI for better understanding:


Default Situation

Since both and are present in the routing table, Track1 and Track2 are up, and as a result Track3 is down:


The interface on R2 shows the status of the tracks, and the priority, currently a 100 due to Track3 being down. (Configured priority 150 – Track3 (50)  = 100). Notice R2 is in Active State.



One Route Down :

Let see what happens when is not reachable from R2 anymore.
That will cause Track1 to go DOWN, therefor the priority is decremented by an additional 10 to 90.  Notice R2 is not Active anymore, due to R2’s 90 priority being less than R7’s 95 priority.



Both Routes Down

When both and are unreachable from R2, Track1 and Track2 will be DOWN. Thus the boolean ‘and’ will change the status of Track3 to UP.  Since Track3 is now UP, only the amounts of the DOWN objects (Track1 and Track2) are used to decrement the priority from 150 -10 -10 to 130. Notice that R2 is Active again.




One thought on “Using the Track Statement

Please leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.