Networking guides, explanations and reader checklists on whilenetworking.com

Packet Tracer Project: Design a Redundant HSRP Gateway Setup to Ensure High Availability During Router Failover Scenarios

In modern network architectures, a single point of failure at the default gateway can bring an entire subnet to a halt. Hot Standby Router Protocol (HSRP) is…

In modern network architectures, a single point of failure at the default gateway can bring an entire subnet to a halt. Hot Standby Router Protocol (HSRP) is the industry-standard solution for Cisco IOS devices to provide gateway redundancy without requiring client-side configuration changes. This guide walks you through building a robust HSRP design in Cisco Packet Tracer, integrating essential services like DHCP and DNS while ensuring high availability during router failover scenarios.

Understanding the Architecture and Prerequisites

Before configuring interfaces, it is crucial to understand how HSRP works. The protocol elects an active router based on priority values (default is 100). The active router assumes the virtual IP address as its source for traffic from hosts in the subnet. If the active router fails, the standby router detects the failure via Hello messages and seamlessly takes over the virtual IP.

Prerequisites for this Lab:
* Cisco Packet Tracer: Ensure you are using a version that supports HSRP (PT 8.x or later).
* Topology Components: You will need two routers (e.g., R1 and R2), one Layer 3 switch or access switch, and several end devices (PCs).
* IP Planning: Define your subnetting scheme. For this example, we will use the 192.168.10.0/24 network for hosts.

Step-by-Step Configuration: Creating VLANs and Interfaces

The first step is to segment the network logically using VLANs. This isolates broadcast domains and allows for easier management of traffic flows between different departments or security zones.

  1. Create VLANs on the Switch:
    Access your switch CLI and create two VLANs, one for Management (VLAN 10) and one for Users (VLAN 20). Assign specific ports to these VLANs based on your physical topology.

  2. Configure Router Interfaces:
    On both R1 and R2, configure the physical interfaces connected to the switch as Layer 3 routed ports or subinterfaces if using a trunk link.

    bash
    ! Example configuration for R1 GigabitEthernet0/1
    interface GigabitEthernet0/1
    no shutdown
    ip address 192.168.10.1 255.255.255.0

  3. Configure Router Interfaces:
    Repeat the process for R2, ensuring both routers have an IP address in the same subnet as the hosts to act as default gateways.

Implementing HSRP for High Availability

Now that the physical and Layer 3 foundation is laid, we configure the redundancy protocol. The goal is to create a virtual gateway that clients perceive as a single entity, even though it runs across two physical devices.

Setting Priority and Virtual IP Addresses

To make R1 the primary router, assign it a higher priority than the default 100. We will set R2’s priority to 90. The virtual IP address should be chosen from the subnet but distinct from the physical interface IPs of the routers. Let us use 192.168.10.254 as the virtual IP.

! Configuration for Active Router (R1)
interface GigabitEthernet0/1
 standby 1 ip 192.168.10.254
 standby 1 priority 110
 standby 1 preempt
 ! Optional: Adjust timers for faster failover if needed
 standby 1 timers msec 30 msec 100 

! Configuration for Standby Router (R2)
interface GigabitEthernet0/1
 standby 1 ip 192.168.10.254
 standby 1 priority 90
 standby 1 preempt

What these commands do:
* standby 1 ip: Defines the virtual IP address that will float between routers.
* standby 1 priority: Sets the preference level. Higher numbers win.
* standby 1 preempt: Allows the router to reclaim the active role if its priority is higher than the current active router upon recovery.

Verifying HSRP State with Show Commands

After applying the configuration, verify that the routers have formed a group. Use the show standby brief command on both routers. You should see R1 in the “Active” state and R2 in the “Standby” state, both sharing the same group number (1) and virtual IP.

Integrating DHCP and DNS Services

A redundant gateway is useless if devices cannot obtain network configuration automatically. We will configure a Dynamic Host Configuration Protocol (DHCP) server on the active router to hand out IP addresses, subnet masks, default gateways (the HSRP virtual IP), and DNS server information.

! DHCP Pool Configuration on R1
ip dhcp pool USERS-GROUP
 network 192.168.10.0 255.255.255.0
 default-router 192.168.10.254 ! Points to the HSRP virtual IP
 dns-server 8.8.8.8           ! Public DNS example
 default-leasetime 86400

Ensure that DHCP bindings are excluded for the router’s own interface IPs to prevent them from obtaining addresses from their own pools. This ensures only end devices receive leases.

Troubleshooting and Failover Simulation

The ultimate test of any redundancy design is observing it in action. We will simulate a failure by shutting down the active router’s interface or powering off the device entirely.

  1. Simulate Failure: In Packet Tracer, click on R1 and drag the power switch to “Off,” or use the CLI command shutdown on the active interface.
  2. Observe State Change: Immediately check R2 using show standby brief. It should transition from “Standby” to “Active.”
  3. Verify Connectivity: Ping the virtual IP (192.168.10.254) from a PC in your topology. The ping should succeed with no interruption, demonstrating that the failover was seamless at Layer 3.

Common Errors and Fixes

When implementing HSRP in Packet Tracer or real-world environments, several issues often arise:

  • Mismatched Group Numbers: If R1 uses standby 1 and R2 uses standby 2, they will not communicate as peers. Ensure the group number matches exactly on both devices.
  • Preempt Disabled: Without the preempt command, a router recovering from a crash might remain in standby even if it is ready, unless its priority is lower than the current active router. Always enable preempt for high availability.
  • Authentication Mismatches: In larger networks, HSRP authentication strings are used to prevent rogue routers from joining the group. If authentication is configured on one side but not the other, the state will remain “Init” or “Listen.”

Student Practice Task and Industry Application

Student Practice Task:
Create a topology with two routers and three PCs. Configure R1 as active (priority 105) and R2 as standby (priority 95). Set up a DHCP pool. Shut down R1, document the state change on R2 using screenshots from Packet Tracer, then restore R1 and verify it reclaims the active role due to preempt.

Industry Application:
In enterprise environments, this design protects against ISP outages or core switch failures. By pairing HSRP with EIGRP or OSPF routing protocols, networks can maintain connectivity even if a specific router fails. Security teams often combine this with Access Control Lists (ACLs) to ensure that only the legitimate active router responds to ARP requests, preventing spoofing attacks where an attacker tries to impersonate the gateway.

Conclusion

Designing a redundant HSRP gateway setup is a fundamental skill for any network engineer. By combining VLAN segmentation, Layer 3 routing, DHCP services, and HSRP failover mechanisms, you create a resilient network infrastructure capable of withstanding hardware failures without disrupting user productivity. Always remember to verify your configuration with show standby commands and test failover scenarios regularly to ensure readiness.

Educational-use notice: This tutorial is for learning and controlled lab use only. Test carefully, use backups, and obtain authorization before making changes. Do not run unfamiliar commands on production systems. We accept no responsibility for misuse, damage, data loss, or production issues.