ads

💵 CCNA Salary: $65K - $95K/Year Get Certified and Hit 6 Figures

HSRP Configuration: How to Prevent Network Downtime in 5 Minutes [Cisco Lab]

HSRP network topology diagram showing active and standby routers with virtual IP address



Introduction

Imagine this: It is 2:00 AM on a Sunday. Your phone rings. It is your boss.

The network is down. Nobody can access the internet. Fix it now.

You log in and see that your main router has crashed. All the PCs on the network have lost their default gateway. Nobody can reach anything outside their local subnet.

Your boss is angry. The users are frustrated. And you are the one who gets blamed.

Now imagine the opposite scenario: The router crashes. Nobody notices. Users keep working. You get a quiet alert, fix the router later, and everyone is happy.

The difference? HSRP.

HSRP (Hot Standby Router Protocol) is a Cisco-proprietary protocol that provides gateway redundancy. It ensures that if your primary router fails, a backup router takes over instantly. Users never lose connectivity.

In this guide, I will show you exactly how HSRP works, how to configure it, and how to test failover. By the end, you will be able to protect your network from router failures and save yourself from those 2:00 AM panic calls.

 

📌 New to CCNA? Start with Why Most Beginners Fail CCNA and OSI Model vs TCP/IP.

 

Your Pain Points

Router failures are inevitable. The question is whether you are prepared for them.

Pain Point

Why It Hurts

One router failure takes down the entire network

All PCs lose their gateway. Users cannot work.

I get blamed for network outages

Management expects 100% uptime. They blame you when it fails.

I don't know how to configure HSRP

You have heard of it but never configured it.

I don't understand failover

You don't know how the standby router takes over.

I am scared of CCNA exam questions

HSRP is heavily tested. You need to know it.

Good news: By the end of this guide, all of these problems will disappear.

 

📌 Related: Read How to Read a Cisco Routing Table and Static vs Default Routing for more routing fundamentals.

 

What is HSRP? (The Simple Answer)

HSRP stands for Hot Standby Router Protocol. It is a Cisco-proprietary protocol that provides redundancy for the default gateway in a local subnet.

In a typical network, all PCs have a default gateway configured. If that gateway router fails, the PCs lose connectivity to other networks. HSRP solves this by creating a virtual router that multiple physical routers share.

How It Works

HSRP allows two or more routers to work together as a single group. They share a common virtual IP address and virtual MAC address.

Analogy: Think of HSRP like a hotel front desk. There are multiple staff members (routers), but guests (PCs) only see one front desk (virtual IP). If one staff member leaves, another takes over immediately. The guests never notice the change.

Router Roles in HSRP

Each router in an HSRP group has a specific role:

Role

What It Does

What Happens on Failure

Active Router

Forwards all traffic sent to the virtual IP address 

If it fails, the standby takes over

Standby Router

Backup for the active router 

Becomes active immediately if the active fails

Listening Routers

Monitor the active and standby routers 

Can become standby if needed

 

HSRP States (The Six-Step Process)

HSRP routers go through six states before becoming active. Understanding these states helps with troubleshooting.

State

Description

What Happens

Initial

HSRP is not yet running. This is the starting point when HSRP is first configured or when an interface comes up 

The router does not participate in any group elections

Learn

The router has not yet determined the virtual IP address. It is waiting to receive information from the active router 

The router remains here until it receives a hello message

Listen

The router knows the virtual IP address but is neither active nor standby. It passively monitors hello messages 

It does not send periodic hello messages of its own

Speak

The router actively participates in the election process. It sends periodic hello messages as a candidate for active or standby 

This is where the election happens

Standby

The router is the backup and is ready to take over immediately if the active router fails 

Only one router per group should be in this state

Active

The router is currently forwarding all packets sent to the group's virtual MAC and IP address 

Only one router per group should be in this state

 

HSRP Configuration (Step-by-Step)

Now let us configure HSRP in a real lab.

Lab Topology

We will configure two routers (R1 and R2) with HSRP to provide a virtual gateway for a local subnet.

HSRP lab topology with PC1, SW1, active R1, standby R2, and virtual gateway IP 192.168.1.254.


Device

Interface

IP Address

HSRP Priority

R1

G0/0

192.168.1.1/24

200 (Active)

R2

G0/0

192.168.1.2/24

100 (Standby)

Virtual Router

192.168.1.254

 

Step 1: Configure Basic Settings on Each Router

On R1:

text

Router(config)# hostname R1

R1(config)# interface g0/0

R1(config-if)# ip address 192.168.1.1 255.255.255.0

R1(config-if)# no shutdown

On R2:

text

Router(config)# hostname R2

R2(config)# interface g0/0

R2(config-if)# ip address 192.168.1.2 255.255.255.0

R2(config-if)# no shutdown

 

Step 2: Enable HSRP on the Interface

HSRP is configured on the interface that connects to the local subnet .

On R1:

text

R1(config)# interface g0/0

R1(config-if)# standby version 2

R1(config-if)# standby 1 ip 192.168.1.254

On R2:

text

R2(config)# interface g0/0

R2(config-if)# standby version 2

R2(config-if)# standby 1 ip 192.168.1.254

What These Commands Do:

  • standby version 2 — Enables HSRP version 2 (supports more groups, 0 to 4095) 
  • standby 1 ip 192.168.1.254 — Creates HSRP group 1 with the virtual IP address 

Step 3: Configure Priorities and Preemption

On R1 (Priority 200 — Highest Priority):

text

R1(config)# interface g0/0

R1(config-if)# standby 1 priority 200

R1(config-if)# standby 1 preempt

On R2 (Priority 100 — Lower Priority):

text

R2(config)# interface g0/0

R2(config-if)# standby 1 priority 100

R2(config-if)# standby 1 preempt

What These Commands Do:

  • standby 1 priority 200 — Sets R1 priority to 200 (higher = more preferred). Default is 100 
  • standby 1 preempt — Allows a higher-priority router to take over if it becomes available 

Important: Without preempt, the first router to initialize becomes active, regardless of priority. With preempt, if R1 boots up later, it will take over from R2.

 

Step 4: Configure PCs

Set the default gateway on PCs to the virtual IP address:

  • PC1: IP 192.168.1.10, Gateway 192.168.1.254
  • PC2: IP 192.168.1.20, Gateway 192.168.1.254

 

Verification Commands

Check HSRP Status

text

R1# show standby

Expected Output:

text

Virtual IP address is 192.168.1.254

Active router is local

Standby router is 192.168.1.2

Priority 200 (configured 200)

Check HSRP State

text

R1# show standby brief

Expected Output:

text

Interface   Grp  Pri P State    Active          Standby         Virtual IP

G0/0        1    200 P Active   local           192.168.1.2     192.168.1.254

R2# show standby brief

Interface   Grp Pri P State    Active          Standby         Virtual IP

G0/0        1    100 P Standby 192.168.1.1     local           192.168.1.254

Check Routing Table

text

R1# show ip route

You should see a route to the virtual IP address and the HSRP MAC address.

Check ARP Table

text

PC1> arp -a

The ARP table should show the virtual IP address mapped to the HSRP virtual MAC address.

Failover Testing

Test 1: Active Router Failure

Step 1: Ping the external server from PC1 continuously.

text

PC1> ping 8.8.8.8 -t

Step 2: Simulate a failure on the active router.

text

R1(config)# interface g0/0

R1(config-if)# shutdown

Step 3: Observe the ping output.

The pings may drop a few packets but should resume quickly as R2 takes over. The holdtime is 10 seconds by default, but HSRP should transition in a few seconds.

Step 4: Verify that R2 has become active.

 

R2# show standby brief

R2 should now show as Active.

 

Test 2: Router Recovery with Preemption

Step 1: Re-enable the interface on R1.

 

R1(config)# interface g0/0

R1(config-if)# no shutdown

Step 2: Observe the output.

With preemption enabled, R1 will retake the active role because it has higher priority (200 vs 100) .

Step 3: Verify that R1 is active again.

 

R1# show standby brief

R1 should now show as Active again.

 

Interface Tracking (Advanced Feature)

Interface tracking allows HSRP to monitor an additional interface and adjust priority if it fails.

Example: If the WAN interface on the active router fails, its priority should drop so the standby router takes over.

text

R1(config)# track 1 interface serial0/0/0 line-protocol

R1(config)# interface g0/0

R1(config-if)# standby 1 track 1 decrement 10

What This Does:

  • Track 1 monitors serial0/0/0
  • If the serial interface fails, the HSRP priority decreases by 10
  • The standby router (with higher effective priority) takes over 

This is an advanced feature that ensures HSRP is aware of failures beyond the local LAN.

 

Common HSRP Mistakes

Mistake

Why It Fails

Fix

Missing standby version 2

Version 1 has group range 0-255; version 2 supports 0-4095 

Use standby version 2 on both routers

Forgetting standby ip

No virtual IP address configured

Configure standby 1 ip 192.168.1.254

Inconsistent group numbers

Routers in different groups cannot form adjacency

Use the same group number on both routers

No preempt configured

Higher-priority router won't take over after recovery 

Add standby 1 preempt on both routers

Priority tie without IP tiebreaker

The router with the highest IP address wins 

Configure different priorities to avoid confusion

 

Summary: What You Learned Today

Concept

What You Now Know

HSRP

Cisco-proprietary protocol providing gateway redundancy 

Active Router

Forwards traffic for the virtual IP address 

Standby Router

Backup that takes over if the active fails 

Virtual IP

The shared IP address used as the default gateway 

Priority

Determines which router becomes active (higher = better) 

Preemption

Allows higher-priority router to take over after recovery 

States

Initial → Learn → Listen → Speak → Standby → Active 

Interface Tracking

Monitors additional interfaces and adjusts priority 

📌 Related: Read How to Read a Cisco Routing Table and Static vs Default Routing for more routing fundamentals.

 

Your Action Step for Today

  1. Open Cisco Packet Tracer and create two routers.
  2. Configure IP addresses and enable HSRP on both routers.
  3. Set priorities (200 on R1, 100 on R2) and enable preemption.
  4. Configure a PC with the virtual IP as the default gateway.
  5. Test failover by shutting down the active router.
  6. Test recovery by re-enabling the active router.
  7. Comment below with your experience.

 

Final Thoughts

Router failures are inevitable. But they do not have to mean downtime.

HSRP gives you the ability to provide gateway redundancy without any manual intervention. Users never notice when the active router fails because the standby router takes over automatically.

Remember:

  • The active router is the one that forwards traffic.
  • The standby router waits and takes over if the active fails.
  • Priority determines which router becomes active.
  • Preemption allows the higher-priority router to reclaim the active role.

If you can learn this, you can save your job from those 2:00 AM panic calls.

 

📚 Previous Lectures in This Series

️: Subnetting Made Easy

️: TCP vs UDP

️: Wildcard Masks

️: IPv6 Addressing

️: How to Configure OSPF in Packet Tracer

️ : OSPF Neighbor Down? Common Causes and Fixes


   ➡️ Next: Inter-VLAN Routing Not Working? Here's How to Fix It


If this guide helped you, share it with someone who is struggling with HSRP.

 

Post a Comment

0 Comments