PTL-0032 Routing

HSRP First-Hop Gateway Failover

Configure Hot Standby Router Protocol (HSRPv2) priority and preemption across redundant gateway routers to provide high-availability default gateway services and verify failover.

Level
Advanced
Time
60 min
Packet Tracer
8.2+
Simulator
Tested in Packet Tracer
You configure
Core-R3, Edge-R1, Edge-R2, Switch-S1
Last reviewed

Packet Tracer files for HSRP First-Hop Gateway Failover

FILES Packet Tracer topology

Download starter file

starter.pkt, 76 KB. Open it in Cisco Packet Tracer 8.2+. Install Packet Tracer.

Solution / reference file

The completed topology with every task configured. Try the lab first and use this to check your work or when you are stuck.

Download solution file

completed.pkt, 77 KB.

File checksums (SHA-256)
starter.pkt
184704416b4351962fc1ac8bac139949ea47745dfb75308f2e1682e2c3ab5d95
completed.pkt
1aa3d50ce3b3e9fe2e93fa9d190478e1d253e30809f4ee02e8bef279c97fc2e6

Part of BSIT Networking Curriculum Learning Path (step 31 of 56) and CCNA-Aligned Topical Study Path (step 31 of 56).

In traditional IP networks, end-user workstations are configured with a single default gateway address (e.g., 192.168.1.1). If the physical router interface serving as that gateway fails, or if the router loses its upstream connection, all local hosts lose external network access until manual re-addressing or dynamic DHCP reconfiguration occurs.

Hot Standby Router Protocol (HSRP) is a Cisco proprietary First-Hop Redundancy Protocol (FHRP) designed to eliminate this single point of failure. Redundant routers share a Virtual IP (VIP) address and a Virtual MAC address. One router is elected as the Active router and actively processes and forwards traffic destined to the virtual MAC. A second router acts as the Standby router, monitoring hello heartbeats. If the Active router stops sending hello packets, the Standby router seamlessly assumes the Active forwarding role without requiring client configuration changes.

In this advanced laboratory, you will configure HSRP version 2 on two Cisco 4321 edge routers (Edge-R1 and Edge-R2). You will establish deterministic active/standby roles using priority configuration, enforce preemption, test end-to-end client connectivity, and simulate an active gateway failure to observe state transitions and verify transparent failover.


Learning Objectives#

  • Explain the necessity of First-Hop Redundancy Protocols (FHRP) in avoiding single points of failure at the default gateway.
  • Configure Hot Standby Router Protocol version 2 (HSRPv2) on Cisco IOS edge routers.
  • Assign and verify virtual IP (VIP) and virtual MAC addresses within an HSRP standby group.
  • Configure custom HSRP priority and preemption to establish deterministic Active and Standby gateway forwarding roles.
  • Examine HSRP state machine transitions (Listen, Speak, Standby, Active) using Cisco IOS verification commands.
  • Simulate an active router interface failure and verify transparent gateway failover to the standby router with uninterrupted host connectivity.
  • Validate HSRP preemption behavior when the primary gateway recovers from failure.

Prerequisites#

  • Completion of PTL-0010 (Router-on-a-Stick Inter-VLAN Routing) or PTL-0019 (Layer 3 Switch SVIs and Routed Ports).
  • Understanding of default gateway operation, ARP resolution, and proxy ARP mechanics.
  • Familiarity with basic OSPF single-area routing convergence.

Topology#

The enterprise topology consists of two redundant edge routers connecting an internal client LAN to an upstream core router and external web server:

HSRP First-Hop Gateway Failover Topology Diagram
HSRP First-Hop Gateway Failover Topology Diagram
                  +---------------------------+
                  |    Core-R3 (Cisco 2911)   |
                  |  Lo0: 3.3.3.3/32          |
                  +-------------+-------------+
                         /             \
       Gi0/0 (10.10.12.2/30)         Gi0/1 (10.10.23.2/30)
                       /                 \
                      /                   \
    Gi0/0/0 (10.10.12.1/30)           Gi0/0/0 (10.10.23.1/30)
+---------------------------+       +---------------------------+
|    Edge-R1 (Cisco 4321)   |       |    Edge-R2 (Cisco 4321)   |
|  Primary Gateway          |       |  Standby Gateway          |
|  Gi0/0/1: 192.168.1.2/24  |       |  Gi0/0/1: 192.168.1.3/24  |
|  HSRP Grp 1: Pri 110, VIP |       |  HSRP Grp 1: Pri 100, VIP |
|  Preempt Enabled          |       |  Preempt Enabled          |
+-------------+-------------+       +-------------+-------------+
       Gi0/0/1 \                         / Gi0/0/1
                \                       /
           Fa0/1 \                     / Fa0/2
              +---------------------------+
              |   Switch-S1 (2960-24TT)   |
              |   VLAN 1: 192.168.1.5/24  |
              +-------------+-------------+
                     /             \
               Fa0/10               Fa0/11
                 /                     \
       +-------------------+ +-------------------+
       |   PC1 (PC-PT)     | |   PC2 (PC-PT)     |
       |  192.168.1.10/24  | |  192.168.1.20/24  |
       |  GW: 192.168.1.1  | |  GW: 192.168.1.1  |
       +-------------------+ +-------------------+

Addressing Table#

Device Interface IP Address Subnet Mask Default Gateway HSRP Role & Group
Edge-R1 Gi0/0/0 10.10.12.1 255.255.255.252 N/A Uplink to Core-R3
Gi0/0/1 192.168.1.2 255.255.255.0 N/A Physical LAN IP
Gi0/0/1 (HSRP) 192.168.1.1 255.255.255.0 N/A Active Gateway (Priority 110, Preempt)
Edge-R2 Gi0/0/0 10.10.23.1 255.255.255.252 N/A Uplink to Core-R3
Gi0/0/1 192.168.1.3 255.255.255.0 N/A Physical LAN IP
Gi0/0/1 (HSRP) 192.168.1.1 255.255.255.0 N/A Standby Gateway (Priority 100, Preempt)
Core-R3 Gi0/0 10.10.12.2 255.255.255.252 N/A Link to Edge-R1
Gi0/1 10.10.23.2 255.255.255.252 N/A Link to Edge-R2
Gi0/2 203.0.113.1 255.255.255.0 N/A Link to Web-Server
Loopback0 3.3.3.3 255.255.255.255 N/A Router ID / Loopback
Switch-S1 VLAN 1 192.168.1.5 255.255.255.0 192.168.1.1 Management SVI
PC1 Fa0 192.168.1.10 255.255.255.0 192.168.1.1 LAN Client 1
PC2 Fa0 192.168.1.20 255.255.255.0 192.168.1.1 LAN Client 2
Web-Server Fa0 203.0.113.100 255.255.255.0 203.0.113.1 Enterprise Web Server

Lab Tasks#

  1. Verify initial problem state: LAN clients pointing to default gateway 192.168.1.1 fail to reach external destinations because no node responds to ARP for 192.168.1.1.
  2. Configure HSRP version 2 on Edge-R1 LAN interface Gi0/0/1 with Virtual IP 192.168.1.1, priority 110, and preemption.
  3. Configure HSRP version 2 on Edge-R2 LAN interface Gi0/0/1 with Virtual IP 192.168.1.1, priority 100, and preemption.
  4. Verify HSRP state convergence and virtual MAC address generation (0000.0c9f.f001).
  5. Verify end-to-end IP communication from PC1 and PC2 to both the virtual gateway (192.168.1.1) and external Web Server (203.0.113.100).
  6. Simulate active gateway failure by shutting down Gi0/0/1 on Edge-R1 and verify automatic, seamless failover to Edge-R2.
  7. Re-enable Gi0/0/1 on Edge-R1 and verify preemption restores Edge-R1 as the Active forwarder.

Configuration Walkthrough#

Step 1: Verify Initial Problem State#

From PC1, open the Command Prompt and attempt to ping the configured default gateway:

ping 192.168.1.1

Expected Result: The ping fails with Request timed out because no active router is currently assigned the virtual IP 192.168.1.1.

Step 2: Configure HSRPv2 on Primary Gateway (Edge-R1)#

Enter global configuration mode on Edge-R1. Configure HSRP on LAN interface GigabitEthernet0/0/1:

Edge-R1# configure terminal
Edge-R1(config)# interface GigabitEthernet0/0/1
Edge-R1(config-if)# standby version 2
Edge-R1(config-if)# standby 1 ip 192.168.1.1
Edge-R1(config-if)# standby 1 priority 110
Edge-R1(config-if)# standby 1 preempt
Edge-R1(config-if)# end
Edge-R1# write memory

Note: The default HSRP priority is 100. Setting the priority to 110 ensures Edge-R1 wins the active election. Enabling preempt permits Edge-R1 to reclaim the active role if it rejoins after an outage.

Step 3: Configure HSRPv2 on Secondary Gateway (Edge-R2)#

Enter global configuration mode on Edge-R2. Configure HSRP on LAN interface GigabitEthernet0/0/1:

Edge-R2# configure terminal
Edge-R2(config)# interface GigabitEthernet0/0/1
Edge-R2(config-if)# standby version 2
Edge-R2(config-if)# standby 1 ip 192.168.1.1
Edge-R2(config-if)# standby 1 priority 100
Edge-R2(config-if)# standby 1 preempt
Edge-R2(config-if)# end
Edge-R2# write memory

Verification#

1. Primary Gateway Role (Edge-R1)#

Execute show standby brief on Edge-R1:

Edge-R1# show standby brief
                     P indicates configured to preempt.
                     |
Interface   Grp  Pri P State    Active          Standby         Virtual IP
Gig0/0/1    1    110 P Active   local           192.168.1.3     192.168.1.1

2. Standby Gateway Role (Edge-R2)#

Execute show standby brief on Edge-R2:

Edge-R2# show standby brief
                     P indicates configured to preempt.
                     |
Interface   Grp  Pri P State    Active          Standby         Virtual IP
Gig0/0/1    1    100 P Standby  192.168.1.2     local           192.168.1.1

3. Client IP Connectivity#

From PC1, ping the virtual default gateway:

ping 192.168.1.1

Result: 4/4 replies received (100% success).

From PC1, ping the external Web Server:

ping 203.0.113.100

Result: 4/4 replies received (100% success).

4. Failover Simulation#

Shut down LAN interface on Edge-R1:

Edge-R1(config)# interface GigabitEthernet0/0/1
Edge-R1(config-if)# shutdown

Observe Edge-R2:

Edge-R2# show standby brief
Interface   Grp  Pri P State    Active          Standby         Virtual IP
Gig0/0/1    1    100 P Active   local           unknown         192.168.1.1

Verify PC1 continues to ping 203.0.113.100 with 0% packet loss!

5. Preemption and Recovery#

Restore Edge-R1 LAN interface:

Edge-R1(config)# interface GigabitEthernet0/0/1
Edge-R1(config-if)# no shutdown

Verify Edge-R1 immediately preempts and reclaims Active state, while Edge-R2 gracefully returns to Standby.


Troubleshooting#

  • State Stuck in Speak or Init: Ensure physical LAN interfaces on both routers are in the up/up operational state. Verify that both routers are in the same IP subnet (192.168.1.0/24) and that switchports on Switch-S1 are not blocked by STP.
  • Both Routers Active (Split-Brain): Check that both routers are configured with matching HSRP versions (standby version 2) and group numbers (1). If version 1 and version 2 are mixed, they use different multicast addresses (224.0.0.2 vs 224.0.0.102) and will fail to see each other's hello packets.
  • Failover Does Not Occur: Ensure hello and hold timers match across both routers. In Packet Tracer, allow sufficient simulation time (at least 10 seconds hold time) for the standby router to detect missing hellos.
  • Primary Does Not Reclaim Active Role: Verify that standby 1 preempt is configured on Edge-R1. Without preemption, a higher-priority router will remain in Standby state indefinitely until the currently active router fails.

Key Takeaways#

  • First-Hop Redundancy Protocols allow redundant physical routers to present a single virtual gateway IP and MAC address to local clients, eliminating default gateway single points of failure.
  • HSRP version 2 uses multicast address 224.0.0.102 and virtual MAC range 0000.0C9F.F000 through 0000.0C9F.FFFF (where the last three hex digits match the group number).
  • HSRP priority defaults to 100 (range 1-255). The router with the highest priority becomes Active.
  • Preemption is disabled by default in Cisco IOS. It must be explicitly configured with standby <group> preempt on any router intended to deterministically assume the Active role after recovery.

References#

  • Cisco IOS IP Application Services Command Reference: HSRP Commands
  • RFC 2281: Cisco Hot Standby Router Protocol (HSRP)
  • Cisco CCNA Exam Topics (Topic 3.5: First Hop Redundancy Protocols)

Files and Validation Status#

File Purpose Verification Status
assets/starter.pkt Starter lab file with cabling, addressing, and OSPF active, but HSRP unconfigured Verified: Pings to VIP 192.168.1.1 fail
assets/completed.pkt Fully completed and converged lab with HSRPv2 priority, preemption, and failover verified Verified: Pings succeed, state transitions pass
assets/topology.png Topology diagram captured from Packet Tracer canvas Verified
configs/Edge-R1.txt Complete running configuration for Edge-R1 Verified
configs/Edge-R2.txt Complete running configuration for Edge-R2 Verified
configs/Core-R3.txt Complete running configuration for Core-R3 Verified
configs/Switch-S1.txt Complete running configuration for Switch-S1 Verified

Reference configurations

Final device configurations from the solution. Like the solution file, these give the answers away.

Core-R3 Core-R3.txt, 844 B
Building configuration...
[OK]
Core-R3#
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to up

00:01:38: %OSPF-5-ADJCHG: Process 1, Nbr 1.1.1.1 on GigabitEthernet0/0 from LOADING to FULL, Loading Done

00:02:17: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on GigabitEthernet0/1 from LOADING to FULL, Loading Done









Core-R3 con0 is now available






Press RETURN to get started.













Core-R3>








Core-R3 con0 is now available






Press RETURN to get started.













Core-R3>terminal length 0
                 ^
% Invalid input detected at '^' marker.
	
Core-R3>show running-config
             ^
% Invalid input detected at '^' marker.
	
Core-R3> 
Core-R3> 
Core-R3> 
Core-R3> 
Core-R3> 
Core-R3>

Download Core-R3.txt

Edge-R1 Edge-R1.txt, 950 B
Building configuration...

Current configuration : 890 bytes
!
version 15.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Edge-R1
!
!
!
!
!
!
!
!
ip cef
no ipv6 cef
!
!
!
!
!
!
!
!
!
!
!
!
no ip domain-lookup
!
!
spanning-tree mode pvst
!
!
!
!
!
!
interface GigabitEthernet0/0/0
 description Uplink to Core-R3
 ip address 10.10.12.1 255.255.255.252
 duplex auto
 speed auto
!
interface GigabitEthernet0/0/1
 description LAN to Switch-S1
 ip address 192.168.1.2 255.255.255.0
 duplex auto
 speed auto
 standby version 2
 standby 1 ip 192.168.1.1
 standby 1 priority 110
 standby 1 preempt
!
router ospf 1
 router-id 1.1.1.1
 log-adjacency-changes
 passive-interface GigabitEthernet0/0/1
 network 10.10.12.0 0.0.0.3 area 0
 network 192.168.1.0 0.0.0.255 area 0
!
ip classless
!
ip flow-export version 9
!
!
!
!
!
!
!
line con 0
!
line aux 0
!
line vty 0 4
 login
!
!
!
end

Download Edge-R1.txt

Edge-R2 Edge-R2.txt, 2.1 KB
Building configuration...
[OK]
Edge-R2#
%HSRP-6-STATECHANGE: GigabitEthernet0/0/1 Grp 1 state Speak -> Standby

%HSRP-6-STATECHANGE: GigabitEthernet0/0/1 Grp 1 state Standby -> Active
enable
Edge-R2#show standby brief
                     P indicates configured to preempt.
                     |
Interface   Grp  Pri P State    Active          Standby         Virtual IP
Gig0/0/1    1    100 P Active   local           unknown         192.168.1.1    
Edge-R2# 
Edge-R2#enable
Edge-R2#show standby brief
                     P indicates configured to preempt.
                     |
Interface   Grp  Pri P State    Active          Standby         Virtual IP
Gig0/0/1    1    100 P Active   local           unknown         192.168.1.1    
Edge-R2# 
Edge-R2#
%HSRP-6-STATECHANGE: GigabitEthernet0/0/1 Grp 1 state Speak -> Standby
enable
Edge-R2#show standby brief
                     P indicates configured to preempt.
                     |
Interface   Grp  Pri P State    Active          Standby         Virtual IP
Gig0/0/1    1    100 P Standby  192.168.1.2     local           192.168.1.1    
Edge-R2#enable
Edge-R2#terminal length 0
                 ^
% Invalid input detected at '^' marker.
	
Edge-R2#show running-config
Building configuration...

Current configuration : 866 bytes
!
version 15.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Edge-R2
!
!
!
!
!
!
!
!
ip cef
no ipv6 cef
!
!
!
!
!
!
!
!
!
!
!
!
no ip domain-lookup
!
!
spanning-tree mode pvst
!
!
!
!
!
!
interface GigabitEthernet0/0/0
 description Uplink to Core-R3
 ip address 10.10.23.1 255.255.255.252
 duplex auto
 speed auto
!
interface GigabitEthernet0/0/1
 description LAN to Switch-S1
 ip address 192.168.1.3 255.255.255.0
 duplex auto
 speed auto
 standby version 2
 standby 1 ip 192.168.1.1
 standby 1 preempt
!
router ospf 1
 router-id 2.2.2.2
 log-adjacency-changes
 passive-interface GigabitEthernet0/0/1
 network 10.10.23.0 0.0.0.3 area 0
 network 192.168.1.0 0.0.0.255 area 0
!
ip classless
!
ip flow-export version 9
!
!
!
!
!
!
!
line con 0
!
line aux 0
!
line vty 0 4
 login
!
!
!
end

Download Edge-R2.txt

Switch-S1 Switch-S1.txt, 1.9 KB
Building configuration...
[OK]
Switch-S1#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up

%LINK-5-CHANGED: Interface FastEthernet0/2, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up

%LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down

%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
enable
Switch-S1#terminal length 0
                   ^
% Invalid input detected at '^' marker.
	
Switch-S1#show running-config
Building configuration...

Current configuration : 1149 bytes
!
version 12.2
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Switch-S1
!
!
!
no ip domain-lookup
!
!
!
spanning-tree mode pvst
spanning-tree extend system-id
!
interface FastEthernet0/1
!
interface FastEthernet0/2
!
interface FastEthernet0/3
!
interface FastEthernet0/4
!
interface FastEthernet0/5
!
interface FastEthernet0/6
!
interface FastEthernet0/7
!
interface FastEthernet0/8
!
interface FastEthernet0/9
!
interface FastEthernet0/10
!
interface FastEthernet0/11
!
interface FastEthernet0/12
!
interface FastEthernet0/13
!
interface FastEthernet0/14
!
interface FastEthernet0/15
!
interface FastEthernet0/16
!
interface FastEthernet0/17
!
interface FastEthernet0/18
!
interface FastEthernet0/19
!
interface FastEthernet0/20
!
interface FastEthernet0/21
!
interface FastEthernet0/22
!
interface FastEthernet0/23
!
interface FastEthernet0/24
!
interface GigabitEthernet0/1
!
interface GigabitEthernet0/2
!
interface Vlan1
 ip address 192.168.1.5 255.255.255.0
!
ip default-gateway 192.168.1.1
!
!
!
!
line con 0
!
line vty 0 4
 login
line vty 5 15
 login
!
!
!
!
end

Download Switch-S1.txt

  • Routing
  • Hsrp
  • Fhrp
  • High Availability
  • Preemption
  • Default Gateway
  • Cisco IOS

This page is generated from labs/routing/hsrp-first-hop-gateway-failover/README.md in the repository. Corrections go there.

Search

Type at least two letters, for example OSPF, DHCP relay or VLAN.