HSRP Priority and Preemption
Lab Objectives
- Configure HSRP priority to control which router becomes the HSRP active for the 10.10.10.0/24 link.
- Enable HSRP preemption so a higher-priority router will automatically take over when it returns.
- Verify HSRP state and behavior using show commands.
Lab Tasks (Try It Yourself First!)
Complete these tasks WITHOUT looking at the solution below. Use
?andshowcommands to figure it out.
Task 1: Configure HSRP on the R1–R2 link
On both R1 and R2 configure HSRP group 1 on interface Gi0/0 (the 10.10.10.0/24 link). Use 10.10.10.254 as the HSRP virtual IP. Configure R1 to be the preferred Active by giving it a higher HSRP priority than R2.
Task 2: Enable preemption
On R1 enable HSRP preemption so that if R1 is rebooted (or loses connectivity) and then returns it will reclaim the Active role automatically if it has the higher priority.
Task 3: Verify HSRP operation
On both R1 and R2 verify the HSRP configuration and show which router is Active or Standby. Then simulate a failover by shutting down Gi0/0 on the Active router and confirm the other router becomes Active. Re-enable the original router interface and confirm preemption causes it to resume being Active.
Think About It: If preemption were disabled, what would happen after the higher-priority router returns to service? Why might a network operator intentionally disable preemption in a production environment?
Lab Solution
Task 1 Solution: Configure HSRP on the R1–R2 link
What we are doing: We create an HSRP group on the R1–R2 link (10.10.10.0/24) and assign a virtual IP address that hosts on this point-to-point segment can use as their default gateway. We set R1’s HSRP priority higher than R2 so R1 will be Active when both are up.
! On R1
interface GigabitEthernet0/0
ip address 10.10.10.1 255.255.255.0
standby 1 ip 10.10.10.254
standby 1 priority 150
! On R2
interface GigabitEthernet0/0
ip address 10.10.10.2 255.255.255.0
standby 1 ip 10.10.10.254
standby 1 priority 100
What just happened:
interface GigabitEthernet0/0— enters interface configuration for the link between R1 and R2.ip address ...— ensures the physical interface has the correct address from the topology.standby 1 ip 10.10.10.254— creates HSRP group 1 and sets the virtual IP address that hosts use as their gateway. Both routers must use the same virtual IP for the group.standby 1 priority X— sets the HSRP priority. Higher numeric value wins to become Active. R1 set to 150 (preferred Active), R2 set to 100 (backup).
Verify:
! On R1
show standby
HSRP is enabled on interface GigabitEthernet0/0
Group number: 1
State is Active
Virtual IP address is 10.10.10.254
Active router is local
Standby router is 10.10.10.2
Priority 150 (configured)
Preemption: Disabled
! On R2
show standby
HSRP is enabled on interface GigabitEthernet0/0
Group number: 1
State is Standby
Virtual IP address is 10.10.10.254
Active router is 10.10.10.1
Standby router is local
Priority 100 (configured)
Preemption: Disabled
Tip: The
Statefield shows whether this router is Active or Standby. “Active” here means this router is currently forwarding packets for the virtual IP.
Task 2 Solution: Enable preemption
What we are doing: Preemption allows a router that becomes available and has a higher priority to take over the Active role automatically. We enable it on R1 so it will reclaim the Active role after maintenance.
! On R1
interface GigabitEthernet0/0
standby 1 preempt
What just happened:
standby 1 preempt— enables preemption for HSRP group 1 on this interface. With preempt enabled, if R1 (higher priority) boots or returns after an outage, it will issue an HSRP takeover and become Active again.
Verify:
! On R1
show standby
HSRP is enabled on interface GigabitEthernet0/0
Group number: 1
State is Active
Virtual IP address is 10.10.10.254
Active router is local
Standby router is 10.10.10.2
Priority 150 (configured)
Preemption: Enabled
Real-world note: In production, enabling preemption helps ensure the most capable router (e.g., with more CPU/memory or better link to the internet) handles traffic when available. However, preemption can cause brief traffic disruption during takeovers; some networks deliberately delay or disable preemption to avoid unnecessary flapping.
Task 3 Solution: Verify failover and preemption behavior
What we are doing: We simulate an Active failure by shutting down the Active router’s interface, verify the other router becomes Active, then bring the interface back up and verify preemption returns Active to the higher-priority router.
! Simulate failure on R1 (Active) --> run on R1:
interface GigabitEthernet0/0
shutdown
! On R2 verify it became Active:
show standby
HSRP is enabled on interface GigabitEthernet0/0
Group number: 1
State is Active
Virtual IP address is 10.10.10.254
Active router is local
Standby router is 10.10.10.1
Priority 100 (configured)
Preemption: Disabled
! Restore interface on R1:
interface GigabitEthernet0/0
no shutdown
! On R1 confirm preemption:
show standby
HSRP is enabled on interface GigabitEthernet0/0
Group number: 1
State is Active
Virtual IP address is 10.10.10.254
Active router is local
Standby router is 10.10.10.2
Priority 150 (configured)
Preemption: Enabled
What just happened: When R1’s interface was shut, R1 no longer participated in HSRP so R2 saw no higher-priority neighbor and transitioned to Active. When R1 returned and preemption was enabled, R1 took the Active role again because its priority (150) is greater than R2’s (100).
Troubleshooting Scenario
Scenario: Preemption is not occurring after R1 returns
Symptom: After re-enabling Gi0/0 on R1, R2 remains Active and R1 stays Standby.
Your task: Find and fix the issue. Hint: Check whether preemption is actually enabled on R1 and look at priorities.
Solution:
- Verify on R1:
show standby
- If
Preemption: Disabled, enable it:
interface GigabitEthernet0/0
standby 1 preempt
- If R1’s priority is not higher than R2’s, raise it:
interface GigabitEthernet0/0
standby 1 priority 150
Explanation: Preemption must be explicitly enabled to allow takeover. Also, priority value determines who wins.
Verification Checklist
- HSRP group 1 configured on Gi0/0 of R1 and R2 with virtual IP 10.10.10.254.
- R1 has a higher priority (150) than R2 (100).
- Preemption enabled on R1.
- Failover test: shutting Gi0/0 on R1 moves Active role to R2; restoring Gi0/0 on R1 returns Active to R1.
Common Mistakes
| Symptom | Cause | Fix |
|---|---|---|
| R1 never becomes Active after return | Preemption not enabled on R1 | interface Gi0/0 → standby 1 preempt |
| Both routers show same priority but unexpected Active selection | One router has lower IP or tie-breaker wins | Increase preferred router’s standby 1 priority X to higher value |
| Virtual IP unreachable | Virtual IP not configured the same on both routers | Ensure standby 1 ip 10.10.10.254 configured on both sides |
Warning: Using identical physical IP addresses or misconfigured virtual IPs can disrupt routing. Always verify interface addresses first with
show ip interface brief.
Challenge Task
Configure HSRP group 2 for the 10.10.20.0/24 link (R1 Gi0/1 to R3 Gi0/1) using the same principles: choose a virtual IP, set priorities so R3 is preferred Active, and enable preemption on R3. Demonstrate a failover and recovery.
Final thought: HSRP priority and preemption give you control over which box handles gateway duties. Think of priority like “seniority” in a team — the most senior person leads, but preemption lets senior staff retake leadership automatically when they return. In production, balance automatic recovery against the chance of causing traffic interruptions during takeovers.