Lesson Contents
HSRP Object Tracking Interface monitors the operational state of a specific interface and automatically adjusts the priority of a Hot Standby Router Protocol (HSRP) router when that interface goes down, triggering a failover to the standby router.
In this lesson, you’ll learn how to configure object tracking on an upstream interface and link it to an HSRP group with a priority decrement. We’ll configure object tracking, associate it with an HSRP group, simulate an interface failure, and verify the automatic failover to another HSRP router.
Key Takeaways
- HSRP object tracking monitors the state of a specific interface and automatically adjusts router priority when the tracked interface fails, triggering failover without requiring manual intervention.
- Create a track object with
track <number> interface <interface> line-protocolto monitor whether an interface’s line-protocol is up or down. - Associate a track object to an HSRP group using
standby <group> track <number> decrement <value>, which reduces the router’s priority by the specified amount when the tracked object fails. - Both the active and standby routers should have the same track object configured so they monitor the same conditions and can respond appropriately to network changes. It’s not a requirement but a best practice.
- When a tracked interface goes down, the router’s priority is automatically decremented; if this causes the active router’s priority to drop below the standby router’s priority, the standby router becomes active (assuming preemption is enabled).
- Verify track object status with
show trackto confirm the object is monitoring the correct interface and displays which HSRP groups are tracking it. - Use
show standbyto display detailed HSRP state, including the current track object status and whether a priority decrement is active for each group.
Prerequisites
You should understand HSRP Basic Configuration, including how to configure standby groups and virtual IP addresses. Object tracking is not too difficult so you’ll learn it as we go through this lesson.
Configuration
Here’s the topology we’ll use for this lab:
Here’s what we have:
- R1 and R2 are routers that will run HSRP:
- R1 is the primary router with priority 110.
- R2 is the primary router with priority 105.
- We’ll run HSRP on the 192.168.12.0/24 subnet.
R3 is an upstream router on the 192.168.123.0/24 segment if you want to test reaching something upstream.
Configurations
Want to take a look for yourself? Here you will find the startup configuration of each device.
R1
hostname R1
!
ip cef
!
interface Ethernet0/1
ip address 192.168.12.1 255.255.255.0
!
interface Ethernet0/2
ip address 192.168.123.1 255.255.255.0
!
end
R2
hostname R2
!
ip cef
!
interface Ethernet0/1
ip address 192.168.12.2 255.255.255.0
!
interface Ethernet0/2
ip address 192.168.123.2 255.255.255.0
!
end
R3
hostname R3
!
ip cef
!
interface Ethernet0/1
ip address 192.168.123.3 255.255.255.0
!
end
Track Object for Interface Line-Protocol State
Object tracking lets HSRP react to network changes. When an interface goes down, the track object immediately detects the change and notifies HSRP to adjust its behavior. We’ll create a track object that monitors whether an interface’s line-protocol is up or down.
On R1, create track object 100 to monitor the line-protocol state of Ethernet0/2:
R1(config)#track 100 interface Ethernet0/2 line-protocol
R1(config-track)#exit
R1(config)#
This track object immediately detects when Ethernet0/2’s line-protocol goes down and reports that change to HSRP, which can then trigger a failover.
The line-protocol keyword monitors the line protocol state of the interface. That’s the second half of what you see in show interfaces:
Ethernet0/2 is up, line protocol is up
The first part is the hardware/administrative status, the second part is the line protocol (Layer 2) status. Our track object follows that second part. Shutting the interface down or pulling the cable takes the line protocol down, so the object goes down too.
Alternatively, you can use ip routing. This is a bit stricter. The object is only up when all three of these conditions are true:
- IP routing is enabled and active on the interface.
- The line protocol state of the interface is up.
- The interface has a known IP address.
If any of these three is false, the object goes down. In other words, ip routing includes everything line-protocol checks, and then some.
Why would you want that? The classic example is a serial interface running PPP. LCP can negotiate successfully so the line protocol is up, while IPCP negotiation fails so the interface never gets a usable IP address. With line-protocol the track object stays up and HSRP happily keeps forwarding into a black hole. With ip routing the object goes down and you get your failover. The same idea applies to any interface where the IP address is negotiated or learned instead of statically configured, for example DHCP or IPCP.
For a plain Ethernet uplink with a static IP address like the one in this lab, line-protocol is what you want.
| Keyword | Object is up when | Typical use |
|---|---|---|
line-protocol |
The interface line protocol is up (Layer 2). | Interfaces with a static IP address. Most failover scenarios. |
ip routing |
IP routing is enabled and active on the interface, the line protocol is up, and the interface has a known IP address. | Interfaces where the IP address is negotiated or learned, for example PPP/IPCP or DHCP. |
HSRP Group with Priority Decrement
Now configure HSRP Group 1 on Ethernet0/1 and associate it with track object 100. When track object 100 goes down, R1’s priority will be decremented by 10 points, allowing R2 to become the active router. Here’s how to do this:
R1(config)#interface Ethernet0/1
R1(config-if)#standby 1 priority 110
R1(config-if)#standby 1 preempt
R1(config-if)#standby 1 track 100 decrement 10
R1(config-if)#standby 1 ip 192.168.12.254
R1(config-if)#exit
R1(config)#
Let me explain what we have here:
standby 1 priority 110sets R1’s priority to 110 for Group 1, making it the active router.standby 1 preemptenables HSRP Preemption so that R1 will actively claim the active role if its priority becomes higher than the current active router.standby 1 track 100 decrement 10associates track object 100 with this HSRP group and specifies that the priority should be reduced by 10 when the track object goes down.standby 1 ip 192.168.12.254sets the virtual IP address that end hosts will use as their gateway.
The decrement value must be chosen so that the active router’s priority drops below the standby router’s priority when the tracked object fails. In this lab, R1’s priority is 110, and R2’s is 105, so a decrement of 10 is sufficient:
110 – 10 = 100, which is less than 105.
Preemption is required for the standby router to claim active status when the active router’s priority decrements. Without standby 1 preempt enabled, the standby router won’t take over even if the active router’s priority drops below the standby router’s priority. If you configure tracking but the standby router doesn’t become active after the tracked interface fails, verify that standby preempt is enabled on R1 so it can take over again when needed. As a best practice, enable it on both routers.
Track Object and HSRP Group on R2
It is a good idea to configure object tracking on both routers. It’s not a hard requirement, but it’s wise to make R2 monitor the same condition. Without it, R2 keeps its priority of 105 no matter what happens to its own uplink. If R2’s Ethernet0/2 fails, R2 stays at 105 while R1 sits at 110, so R1 remains active. That sounds fine until R1’s uplink fails as well: R1 drops to 100, R2 is still at 105, and R2 takes over as the active router even though it has no working uplink either. Configuring the same track object on both routers keeps the gap between them constant, so the router with the better configured priority wins whenever both are in the same shape.
We’ll create the track object:
R2(config)#track 100 interface Ethernet0/2 line-protocol
R2(config-track)#exit
Now configure HSRP Group 1 on R2 with a lower priority so it becomes the standby router. R2’s priority is 105, which is lower than R1’s 110:
R2(config)#interface Ethernet0/1
R2(config-if)#standby 1 priority 105
R2(config-if)#standby 1 preempt
R2(config-if)#standby 1 track 100 decrement 10
R2(config-if)#standby 1 ip 192.168.12.254
R2(config-if)#exit
R2(config)#
R2’s priority of 105 is lower than R1’s 110, so R2 will be the standby router. However, if track object 100 fails on R1, R1’s priority will be decremented to 100, which is lower than R2’s 105. At that point, R2 will become active because it still has the higher priority.
This completes the configuration.
Verification
Let’s verify our work.
HSRP Group Status Before Failure
Once HSRP has converged, let’s verify the group status on both routers to confirm that R1 is the active router.
On R1, check the brief HSRP status:
R1#show standby brief
P indicates configured to preempt.
|
Interface Grp Pri P State Active Standby Virtual IP
Et0/1 1 110 P Active local 192.168.12.2 192.168.12.254
R1 is the active router for Group 1 with priority 110. R2 is the standby router at 192.168.12.2. On R2, verify the standby status:
R2#show standby brief
P indicates configured to preempt.
|
Interface Grp Pri P State Active Standby Virtual IP
Et0/1 1 105 P Standby 192.168.12.1 local 192.168.12.254
R2 is in standby state, confirming that R1 is active.
HSRP Information with Track Objects
Now let me show you the detailed information about HSRP Group 1 on R1, including the status of the track object:
R1#show standby
Ethernet0/1 - Group 1
State is Active
2 state changes, last state change 00:00:47
Virtual IP address is 192.168.12.254
Active virtual MAC address is 0000.0c07.ac01 (MAC In Use)
Local virtual MAC address is 0000.0c07.ac01 (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 0.512 secs
Preemption enabled
Active router is local
Standby router is 192.168.12.2, priority 105 (expires in 9.216 sec)
Priority 110 (configured 110)
Track object 100 state Up decrement 10
Group name is "hsrp-Et0/1-1" (default)
FLAGS: 1/1
Notice the key line: Track object 100 state Up decrement 10. This tells you that the track object is currently in the up state, so no priority adjustments are being applied.
On R2, the output confirms the standby state:
R2#show standby
Ethernet0/1 - Group 1
State is Standby
2 state changes, last state change 00:00:36
Virtual IP address is 192.168.12.254
Active virtual MAC address is 0000.0c07.ac01 (MAC Not In Use)
Local virtual MAC address is 0000.0c07.ac01 (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 2.688 secs
Preemption enabled
Active router is 192.168.12.1, priority 110 (expires in 8.576 sec)
Standby router is local
Priority 105 (configured 105)
Track object 100 state Up decrement 10
Group name is "hsrp-Et0/1-1" (default)
FLAGS: 0/1
Status of Track Objects
Let’s verify the status of track object 100 on R1 to confirm it’s monitoring the correct interface:
R1#show track
Track 100
Interface Ethernet0/2 line-protocol
Line protocol is Up
1 changes, last change 00:00:59
Tracked by:
HSRP Ethernet0/1 1
Track object 100 shows the Up state and is being tracked by HSRP Group 1 on Ethernet0/1. On R2, verify the track object status:
R2#show track
Track 100
Interface Ethernet0/2 line-protocol
Line protocol is Up
1 changes, last change 00:00:52
Tracked by:
HSRP Ethernet0/1 1
Failure Simulation
Now let’s demonstrate how object tracking triggers failover. We’ll shut down Ethernet0/2 on R1. This will cause track object 100 to go down, triggering HSRP to adjust priorities and fail over:
R1(config)#interface Ethernet0/2
R1(config-if)#shutdown
R1(config-if)#end
Check the HSRP status on R1 immediately after the interface goes down:
R1#show standby brief
P indicates configured to preempt.
|
Interface Grp Pri P State Active Standby Virtual IP
Et0/1 1 100 P Speak 192.168.12.2 unknown 192.168.12.254
Here’s what happened:
- R1’s priority has been decremented from 110 to 100 (because track object 100 is now down).
- R1 is in the “Speak” state because R2 preempted and took the active role.
- The active router has changed to R2 (192.168.12.2).
On R2, verify that it has become the active router:
R2#show standby brief
P indicates configured to preempt.
|
Interface Grp Pri P State Active Standby Virtual IP
Et0/1 1 105 P Active local unknown 192.168.12.254
R2 is now active with its configured priority of 105.
Let’s check the track object status on R1 during the failure:
R1#show track
Track 100
Interface Ethernet0/2 line-protocol
Line protocol is Down (hw admin-down)
2 changes, last change 00:00:15
Tracked by:
HSRP Ethernet0/1 1
Track object 100 now shows the Down state with the reason hw admin-down. This confirms that the tracking mechanism is working correctly and has detected the interface shutdown.
Let me also show you the full HSRP status on R1 during the failure to see how the track object change is reflected in the group state:
R1#show standby
Ethernet0/1 - Group 1
State is Speak
3 state changes, last state change 00:00:13
Virtual IP address is 192.168.12.254
Active virtual MAC address is 0000.0c07.ac01 (MAC Not In Use)
Local virtual MAC address is 0000.0c07.ac01 (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 1.696 secs
Preemption enabled
Active router is 192.168.12.2, priority 105 (expires in 8.192 sec)
Priority 100 (configured 110)
Track object 100 state Down decrement 10
Group name is "hsrp-Et0/1-1" (default)
FLAGS: 0/1
Here’s what we see:
- The output shows “Track object 100 state Down decrement 10”, confirming that the priority decrement of 10 has been applied.
- The configured priority is 110, but the effective priority is now 100 (110 – 10 = 100).
- R1 is in the “Speak” state.
And this is R2:
R2#show standby
Ethernet0/1 - Group 1
State is Active
3 state changes, last state change 00:00:13
Virtual IP address is 192.168.12.254
Active virtual MAC address is 0000.0c07.ac01 (MAC In Use)
Local virtual MAC address is 0000.0c07.ac01 (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 2.304 secs
Preemption enabled
Active router is local
Standby router is unknown
Priority 105 (configured 105)
Track object 100 state Up decrement 10
Group name is "hsrp-Et0/1-1" (default)
FLAGS: 1/1
R2 is now active. Notice that R2’s track object 100 still shows “Up” state because R2’s Ethernet0/2 is still operational. Only R1’s tracked interface is down. If R2’s Ethernet0/2 were also down, R2’s priority would also decrement, and the router with the higher effective priority would remain or become active. This is why configuring the same track object on both routers is a good idea. If both interfaces were down, R1 would become active again.
Restore the Failed Interface
Now let’s restore Ethernet0/2 on R1 by enabling it:
R1(config)#interface Ethernet0/2
R1(config-if)#no shutdown
R1(config-if)#end
Let’s check the HSRP status on R1 after the interface comes back up:
R1#show standby brief
P indicates configured to preempt.
|
Interface Grp Pri P State Active Standby Virtual IP
Et0/1 1 110 P Active local 192.168.12.2 192.168.12.254
R1 has returned to the Active state because:
- Ethernet0/2 is now back up, so track object 100 is Up again.
- R1’s priority for Group 1 is back to 110 (no decrement applied).
- R1’s higher priority (110 > 105) combined with preemption enabled allows R1 to reclaim the active role.
On R2, verify that it has returned to standby:
R2#show standby brief
P indicates configured to preempt.
|
Interface Grp Pri P State Active Standby Virtual IP
Et0/1 1 105 P Standby 192.168.12.1 local 192.168.12.254
R2 has correctly returned to standby state. Let’s also check the object track status on R1:
R1#show track
Track 100
Interface Ethernet0/2 line-protocol
Line protocol is Up
2 changes, last change 00:00:10
Tracked by:
HSRP Ethernet0/1 1
Track object 100 has returned to the Up state, confirming that Ethernet0/2 is fully operational again.
Verifying Final HSRP Status with Track Objects Up
Let’s check the final detailed HSRP status on R1 to confirm that the track object is back to normal:
R1#show standby
Ethernet0/1 - Group 1
State is Active
4 state changes, last state change 00:00:08
Virtual IP address is 192.168.12.254
Active virtual MAC address is 0000.0c07.ac01 (MAC In Use)
Local virtual MAC address is 0000.0c07.ac01 (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 1.408 secs
Preemption enabled
Active router is local
Standby router is 192.168.12.2, priority 105 (expires in 8.704 sec)
Priority 110 (configured 110)
Track object 100 state Up decrement 10
Group name is "hsrp-Et0/1-1" (default)
FLAGS: 1/1
R1 is once again the active router for HSRP Group 1 with full priority. The track object is Up, confirming that the object tracking mechanism is working correctly and has successfully managed the failover and recovery process.
That’s all there is to it!
Configurations
Want to take a look for yourself? Here you will find the final configuration of each device.
R1
hostname R1
!
ip cef
!
track 100 interface Ethernet0/2 line-protocol
!
interface Ethernet0/1
ip address 192.168.12.1 255.255.255.0
standby 1 ip 192.168.12.254
standby 1 priority 110
standby 1 preempt
standby 1 track 100 decrement 10
!
interface Ethernet0/2
ip address 192.168.123.1 255.255.255.0
!
end
R2
hostname R2
!
ip cef
!
track 100 interface Ethernet0/2 line-protocol
!
interface Ethernet0/1
ip address 192.168.12.2 255.255.255.0
standby 1 ip 192.168.12.254
standby 1 priority 105
standby 1 preempt
standby 1 track 100 decrement 10
!
interface Ethernet0/2
ip address 192.168.123.2 255.255.255.0
!
end
R3
hostname R3
!
ip cef
!
interface Ethernet0/1
ip address 192.168.123.3 255.255.255.0
!
end
Conclusion
You now understand how HSRP object tracking monitors interface state changes and automatically adjusts router priority to trigger failover when a tracked interface goes down. The key concept is that a track object can decrement a router’s HSRP priority, allowing a standby router to become active without manual intervention.
We configured track object 100 on both R1 and R2 to monitor the line-protocol state of Ethernet0/2, associated it with HSRP Group 1 using standby 1 track 100 decrement 10, and verified failover by shutting down the tracked interface on R1. When Ethernet0/2 went down, R1’s priority decreased from 110 to 100, causing R2 to become active. When the interface was restored, R1 reclaimed the active role.
Remember that preemption must be enabled for the standby router to take over when the active router’s priority decrements. If both routers’ tracked interfaces fail simultaneously, both routers’ priorities will decrement equally, and the router with the higher configured priority will remain active (or become active if preempt is enabled). If a tracked interface flaps repeatedly, use the delay command in tracking configuration mode to dampen it:
R1(config)#track 100 interface Ethernet0/2 line-protocol
R1(config-track)#delay up 20 down 10
The interface now has to stay down for 10 seconds before the object reports Down, and stay up for 20 seconds before it reports Up. This keeps a flapping link from dragging HSRP back and forth with it.
I hope you enjoyed this lesson. If you have any questions, feel free to leave a comment!