What is HSRP?
What is HSRP?
Hot Standby Router Protocol (HSRP) is First hop redundancy protocol that provides default gateway redundancy.
If the active router fails, the standby router automatically takes over as the default gateway, minimizing network downtime.
- standby 1 priority 120 R1 → Higher priority than R2 ( 100 )
- standby 1 preempt → Allows R1 to become Active again after recovery R2 becomes Standby HSRP Timer
HSRP routers sends multicast Hello messages to determine which router is Active and whether it is still alive.
HSRP version 1 : Multicast IP 224.0.0.2 on UDP port 1985
HSRP version 2 : Multicast IP 224.0.0.102 on UDP port 1985
The Hold timer specifies how long a router waits without receiving Hellos before declaring the Active router down.
| Timer | Default |
|---|---|
| Hello | 3 seconds |
| Hold | 10 seconds |
Maximum HSRP Groups
HSRP version 1 : up to 255 groups ( 0 - 255 )
HSRP version 2 : up to 4095 groups ( 0 - 4095 )
PC Hosts use one virtual IP address as their default gateway.
Behind that virtual gateway, there is one Active router and one Standby router per HSRP group.
HSRP 6 States
| State | Meaning |
|---|---|
| Initial | HSRP is starting |
| Learn | Waiting to learn the virtual IP |
| Listen | Listening for HSRP messages |
| Speak | Sending HSRP hello packets |
| Standby | Backup router |
| Active | Forwarding traffic for the virtual gateway |
Real-World Example
Suppose an office has:
- 200 computers
- Router R1 (Primary)
- Router R2 (Backup)
All PCs use a virtual IP as their default gateway instead of a physical router's IP.
If R1 fails, R2 automatically becomes the gateway.
Refer HSRP Lab 1
Design Lab Topology
IP Addressing
| Device | Interface | IP Address |
|---|---|---|
| R1 | G0/0 | 192.168.10.2/24 |
| R2 | G0/0 | 192.168.10.3/24 |
| Virtual IP | HSRP | 192.168.10.1 |
| PC1 | NIC | 192.168.10.100 |
| PC2 | NIC | 192.168.10.101 |
| Default Gateway | - | 192.168.10.1 |
Step 1: Configure R1
enable
configure terminal
interface GigabitEthernet0/0
ip address 192.168.10.2 255.255.255.0
standby 1 ip 192.168.10.1
standby 1 priority 120
standby 1 preempt
no shutdown
end
Explanation
-
standby 1→ HSRP Group 1 -
ip→ Virtual IP address -
priority 120→ Higher priority than R2 -
preempt→ Allows R1 to become Active again after recovery
Step 2: Configure R2
enable
configure terminal
interface GigabitEthernet0/0
ip address 192.168.10.3 255.255.255.0
standby 1 ip 192.168.10.1
standby 1 priority 100
standby 1 preempt
no shutdown
end
Election Result
| Router | Priority | Role |
|---|---|---|
| R1 | 120 | Active |
| R2 | 100 | Standby |
The router with the highest priority becomes the Active router.
Default priority is 100.
Verify HSRP
show standby
Sample output:
State is Active
Virtual IP address is 192.168.10.1
Active router is local
Standby router is 192.168.10.3
Priority 120
Another useful command:
show standby brief
Example:
Interface Group Priority State Active Standby Virtual IP
Gi0/0 1 120 Active local 192.168.10.3 192.168.10.1
Test Failover
On PC
ping 8.8.8.8 -t
Continuous ping to transmit high unmatched traffic to ISP router
On PC1
ping 192.168.10.1 -t
shutdown the interface Gi0/0 of R1 then R2 will take over..
Shut down R1
interface g0/0
shutdown
Immediately:
- R1 becomes inactive.
- R2 becomes Active.
- The ping may lose only 1–2 packets before continuing.
Bring R1 Back
interface g0/0
no shutdown
Since preempt is enabled:
- R1 (priority 120) becomes Active again.
- R2 returns to Standby.
Comments
Post a Comment