HSRP Configuration and Functionality Guide
HSRP Configuration and Functionality Guide
Search …
1. Configurations
1.1. Active Gateway Election
1.2. Preemption
1.3. Authentication
1.4. HSRP Timers
1.5. HSRP Version 1 and 2
1.6. Object (Interface) Tracking
2. Conclusion
In this lesson, I will explain how HSRP (Hot Standby Routing Protocol)
works and how to configure it. If you have no idea what virtual
gateways are about then make sure to read my introduction lesson
first.
[Link] 1/25
6/28/25, 2:43 PM HSRP (Hot Standby Routing Protocol)
1. Configurations
[Link] 2/25
6/28/25, 2:43 PM HSRP (Hot Standby Routing Protocol)
Configurations
Get Unlimited Access to 812 Cisco Lessons Now Get $1 Trial
Want to try this example yourself? Here, you will find the startup
configuration of each device.
H1
hostname H1
!
no ip routing
!
interface GigabitEthernet0/1
ip address [Link] [Link]
no ip route-cache
duplex auto
speed auto
media-type rj45
!
ip default-gateway [Link]
!
end
R3
hostname R3
!
interface GigabitEthernet0/1
ip address [Link] [Link]
duplex auto
speed auto
media-type rj45
!
Lessons
interface GigabitEthernet0/2
ip address [Link] [Link]
duplex auto
speed auto
media-type rj45
[Link] 3/25
6/28/25, 2:43 PM HSRP (Hot Standby Routing Protocol)
!
Get Unlimited Access to 812 Cisco Lessons Now
end Get $1 Trial
SW1
hostname SW1
!
interface GigabitEthernet0/1
media-type rj45
negotiation auto
!
interface GigabitEthernet0/2
no switchport
ip address [Link] [Link]
negotiation auto
!
interface Vlan1
ip address [Link] [Link]
!
end
SW2
hostname SW2
!
interface GigabitEthernet0/1
media-type rj45
negotiation auto
!
interface GigabitEthernet0/2
no switchport
ip address [Link] [Link]
Lessons
negotiation auto
!
interface Vlan1
ip address [Link] [Link]
!
end
[Link] 4/25
6/28/25, 2:43 PM HSRP (Hot Standby Routing Protocol)
The first thing we’ll do is enable HSRP. We will do this on the VLAN 1
Get Unlimited
interfaces Access
of SW1 to 812 Cisco Lessons Now
and SW2: Get $1 Trial
SW1#
%HSRP-5-STATECHANGE: Vlan1 Grp 1 state Standby ->
Listen
%HSRP-5-STATECHANGE: Vlan1 Grp 1 state Speak ->
Standby
SW2#
%HSRP-5-STATECHANGE: Vlan1 Grp 1 state Standby ->
Active
H1#ping [Link]
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to [Link],
Lessons
timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip
min/avg/max = 6/206/1007 ms
[Link] 5/25
6/28/25, 2:43 PM HSRP (Hot Standby Routing Protocol)
That wasn’t too bad, right? Only one command and HSRP works! There
Get
are Unlimited
a couple ofAccess to 812
other things weCisco
have Lessons [Link]
to look at,Now $1 Trial
We use
[Link] as the virtual IP address, but what MAC address will it
use?
You can see the MAC address of [Link] in the ARP table. Where
did this MAC address come from?
SW1#show standby
Vlan1 - Group 1
State is Standby
3 state changes, last state change 00:03:33
Virtual IP address is [Link]
Active virtual MAC address is 0000.0c07.ac01 (MAC
Not In Use)
Local virtual MAC address is 0000.0c07.ac01 (v1
default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 0.144 secs
Preemption disabled
Active router is [Link], priority 100
(expires in 7.776 sec)
Standby router is local
Lessons
SW2#show standby
Vlan1 - Group 1
State is Active
[Link] 6/25
6/28/25, 2:43 PM HSRP (Hot Standby Routing Protocol)
The active router will respond to ARP requests from computers, and it
will be actively forwarding packets from them. It will send hello
messages to the routers that are in standby mode. Routers in standby
mode will listen to the hello messages, if they don’t receive anything
from the active router, they will wait for the hold time to expire before
taking over. The hold time is 10 seconds by default which is pretty slow;
we’ll see how to speed this up in a bit.
State Explanation
Initial This is the first state when HSRP starts. You’ll see
this just after you configured HSRP or when the
[Link] 7/25
6/28/25, 2:43 PM HSRP (Hot Standby Routing Protocol)
We can see all these steps with a debug command. Let’s shut the VLAN
1 interfaces first so that we can restart HSRP:
SW1
(config)#interface Vlan 1
(config-if)#no shutdown
[Link] 8/25
6/28/25, 2:43 PM HSRP (Hot Standby Routing Protocol)
SW1#
Get Unlimited Access to 812 Cisco Lessons Now Get $1 Trial
HSRP: Vl1 Interface UP
HSRP: Vl1 Starting minimum intf delay (1 secs) -
uptime 997
HSRP: Vl1 Intf min delay expired - uptime 998
HSRP: Vl1 Grp 1 Init: a/HSRP enabled
HSRP: Vl1 Grp 1 Init -> Listen
HSRP: Vl1 Grp 1 Redundancy "hsrp-Vl1-1" state Init -
> Backup
HSRP: Vl1 IP Redundancy "hsrp-Vl1-1" update, Init ->
Backup
HSRP: Vl1 Grp 1 Listen: d/Standby timer expired
(unknown)
HSRP: Vl1 Grp 1 Listen -> Speak
HSRP: Vl1 Grp 1 Redundancy "hsrp-Vl1-1" state Backup
-> Speak
HSRP: Vl1 IP Redundancy "hsrp-Vl1-1" update, Backup
-> Speak
HSRP: Vl1 Grp 1 Speak: d/Standby timer expired
(unknown)
HSRP: Vl1 Grp 1 Standby router is local
HSRP: Vl1 Grp 1 Speak -> Standby
HSRP: Vl1 Grp 1 Redundancy "hsrp-Vl1-1" state Speak
-> Standby
HSRP: Vl1 IP Redundancy "hsrp-Vl1-1" standby,
unknown -> local
HSRP: Vl1 IP Redundancy "hsrp-Vl1-1" update, Speak -
> Standby
HSRP: Vl1 Grp 1 Standby: c/Active timer expired
(unknown)
HSRP: Vl1 Grp 1 Active router is local
HSRP: Vl1 Grp 1 Standby router is unknown, was local
Lessons
[Link] 9/25
6/28/25, 2:43 PM HSRP (Hot Standby Routing Protocol)
Above, you can clearly see the different states we go through before we
end up in the active state. Right now, SW1 is the only switch that is
running HSRP, so let’s enable the VLAN 1 interface of SW2 as well:
SW2(config)#interface Vlan 1
SW2(config-if)#no shutdown
SW2#
HSRP: Vl1 Grp 1 Active router is [Link]
HSRP: Vl1 Nbr [Link] created
HSRP: Vl1 Nbr [Link] active for group 1
HSRP: Vl1 Interface UP
HSRP: Vl1 Starting minimum intf delay (1 secs) -
uptime 1089
HSRP: Vl1 Intf min delay expired - uptime 1090
HSRP: Vl1 Grp 1 Init: a/HSRP enabled
HSRP: Vl1 Grp 1 Init -> Listen
HSRP: Vl1 Grp 1 Redundancy "hsrp-Vl1-1" state Init -
> Backup
HSRP: Vl1 IP Redundancy "hsrp-Vl1-1" update, Init ->
Backup
Lessons
[Link] 10/25
6/28/25, 2:43 PM HSRP (Hot Standby Routing Protocol)
Above, we can see that SW2 is seeing [Link] (SW1) as the active
router. Eventually, it ends up in the standby state.
By default, the switch with the highest priority will become the active
HSRP device. If the priority is the same, then the highest IP address
will be the tie-breaker. Let’s take a look at the priorities:
The priority is the same on both switches. SW2 has a higher IP address,
so it should become the active router, but it’s not. Let’s try increasing its
priority:
Lessons
SW2(config)#interface Vlan 1
SW2(config-if)#standby 1 priority 150
[Link] 11/25
6/28/25, 2:43 PM HSRP (Hot Standby Routing Protocol)
Even though SW2 has a higher priority, SW1 remains the active router.
Another useful command to verify which router is active or standby is
the show standby brief command:
We can confirm that SW2 has a higher priority, but SW1 is still active.
Once HSRP has decided which device should be active, it will stay
active until it goes down. We can overrule this if we want, though…
1.2. Preemption
[Link] 12/25
6/28/25, 2:43 PM HSRP (Hot Standby Routing Protocol)
When we enable preemption, the switch with the highest priority (or IP
Get Unlimited
address in caseAccess to 812
the priority Cisco
is the Lessons
same) Get the
Now become
will always $1new
Trial
active device. Here’s how to enable this:
good idea to use a delay. If a router reboots it might need some time to
“converge”. Maybe OSPF or EIGRP need to form neighbor adjacencies
or spanning tree isn’t ready yet unblocking ports. If you want to add a
delay, then you can do it like this:
[Link] 13/25
6/28/25, 2:43 PM HSRP (Hot Standby Routing Protocol)
1.3. Authentication
HSRP also supports authentication. You can choose between plaintext
or MD5 authentication. Here’s how to configure MD5:
This ensures that all packets sent between the two switches are
authenticated. This prevents someone on the [Link]/24 subnet
from joining our HSRP setup.
SW1(config-if)#standby 1 timers ?
<1-254> Hello interval in seconds
msec Specify hello interval in milliseconds
Lessons
[Link] 14/25
6/28/25, 2:43 PM HSRP (Hot Standby Routing Protocol)
I’ve set the hello time to 100 milliseconds and the hold timer to 300
Get UnlimitedMake
milliseconds. Access toyour
sure 812hold
Ciscotime
Lessons Now
is at least threeGet $1the
times Trial
hello timer. Let’s verify our work:
HSRPv1 HSRPv2
Group
0 – 255 0 – 4095
Numbers
Multicast
[Link] [Link]
Address
(config)#interface Vlan 1
(config-if)#standby version 2
[Link] 15/25
6/28/25, 2:43 PM HSRP (Hot Standby Routing Protocol)
In the picture above, SW2 is the active router because we changed the
priority to 150. That’s great, but what if the interface on SW2 to R3 fails?
Lessons
[Link] 16/25
6/28/25, 2:43 PM HSRP (Hot Standby Routing Protocol)
Make sure you have enabled preemption if you want to use interface
tracking. Here’s an example:
SW2(config)#interface Vlan 1
SW2(config-if)#standby 1 track 1 ?
decrement Priority decrement
shutdown Shutdown group
We can decrease the priority, or you can decide to shut down the entire
HSRP group in case the interface is down. Let’s try decrementing the
priority:
SW2(config-if)#shutdown
SW2#
%TRACK-6-STATE: 1 interface Gi0/2 line-protocol Up -
[Link] 17/25
6/28/25, 2:43 PM HSRP (Hot Standby Routing Protocol)
> Down
Get Unlimited Access to 812 Cisco Lessons Now Get $1 Trial
The interface goes down, so the state of our object changes. Let’s see if
the priority has decreased:
You can see the priority is now 90 instead of the 150 that we
configured.
The priority is now 90, which is lower than SW1 (100). As a result, SW2
will go to the standby state, and SW1 will move to the active state.
Interface tracking is useful but it will only check the state of the
interface. It’s possible that the interface remains in the up state but
that we cannot reach R3. It might be a better idea to use IP SLA instead
since it can check end-to-end connectivity.
SW2(config)#ip sla 1
SW2(config-ip-sla)#icmp-echo [Link]
SW2(config-ip-sla-echo)#frequency 10
[Link] 18/25
6/28/25, 2:43 PM HSRP (Hot Standby Routing Protocol)
We’ll configure SW2 once again so that the priority will decrease by 60
when the object is down:
SW2(config)#interface Vlan 1
SW2(config-if)#standby 1 track 1 decrement 60
Let’s test our configuration. First, we want to make sure that IP SLA is
working:
[Link] 19/25
6/28/25, 2:43 PM HSRP (Hot Standby Routing Protocol)
The priority has decreased, which will cause SW1 to become the active
Get Unlimited Access to 812 Cisco Lessons Now
router: Get $1 Trial
Configurations
Want to take a look for yourself? Here, you will find the final
configuration of each device.
H1
hostname H1
!
no ip routing
!
interface GigabitEthernet0/1
ip address [Link] [Link]
no ip route-cache
duplex auto
speed auto
media-type rj45
!
ip default-gateway [Link]
!
end
Lessons
R3
hostname R3
!
interface GigabitEthernet0/1
[Link] 20/25
6/28/25, 2:43 PM HSRP (Hot Standby Routing Protocol)
SW1
hostname SW1
!
interface GigabitEthernet0/1
media-type rj45
negotiation auto
!
interface GigabitEthernet0/2
no switchport
ip address [Link] [Link]
negotiation auto
!
interface Vlan1
ip address [Link] [Link]
standby version 2
standby 1 ip [Link]
standby 1 timers msec 100 msec 300
standby 1 preempt delay minimum 60
standby 1 authentication md5 key-string
Lessons
MY_SECRET_KEY
!
end
SW2
[Link] 21/25
6/28/25, 2:43 PM HSRP (Hot Standby Routing Protocol)
hostname SW2
Get Unlimited Access to 812 Cisco Lessons Now Get $1 Trial
!
track 1 ip sla 1
!
interface GigabitEthernet0/1
media-type rj45
negotiation auto
!
interface GigabitEthernet0/2
no switchport
ip address [Link] [Link]
negotiation auto
!
interface Vlan1
ip address [Link] [Link]
standby version 2
standby 1 ip [Link]
standby 1 timers msec 100 msec 300
standby 1 priority 150
standby 1 preempt delay minimum 60
standby 1 authentication md5 key-string
MY_SECRET_KEY
standby 1 track 1 decrement 60
!
ip sla 1
icmp-echo [Link]
frequency 10
ip sla schedule 1 life forever start-time now
!
end
2. Conclusion
Lessons
[Link] 22/25
6/28/25, 2:43 PM HSRP (Hot Standby Routing Protocol)
« Previous Lesson
Introduction to Gateway
Redundancy
Next Lesson
Virtual Router Redundancy
Protocol
»
Tags: Gateway
Forum Replies
ramonsito
hi Rene
at the beginning of the lab, i wasn’t able to issue the following commands
SwitchA(config)#interface fa0/17
SwitchA(config-if)#standby 1 ip [Link]
the thing is SwitchA does not have the option standby under interface, not
unless i convert this interface as a layer 3 int with command “no switchport”,
then it has the option, but when i try to type the following command
standby 1 ip [Link]
then it give me the error that overlaps with vlan 1, and this is because the
layer 3 interface does not belong to any vlan, can you please advice.
or should i
ReneMolenaar
Hi Ramon,
[Link] 23/25
6/28/25, 2:43 PM HSRP (Hot Standby Routing Protocol)
You can only use configure HSRP / VRRP / GLBP on “routed” (L3) interfaces,
Getnot
Unlimited Access
on switchports to 812 Cisco Lessons Now
(L2 interfaces). Get $1 Trial
You have two options:
benedictadjei
Hi Rene i lab this on a real cisco equipments and the lab was awesome thank
you very much. Please can you make a video training on how to setup a
complete ACS server and snmp configuration for a newly cisco switch/router.
Moreover, we will like to see more of a recommended way of designing and
implementing cisco configuration a network thank you.
ReneMolenaar
Hi Princek,
I’ll probably do some ACS tutorials/videos. I’m currently adding some ASA
tutorials and ACS will be a nice addon. I already have a lesson for SNMPv3 on
Cisco IOS router:
Lessons
[Link]
snmpv3-on-cisco-ios-router/
About the designing part, anything in particular you are looking for? There’s a
lot to cover when it comes to network design.
[Link] 24/25
6/28/25, 2:43 PM HSRP (Hot Standby Routing Protocol)
Get Unlimitedalok1902
Access to 812 Cisco Lessons Now Get $1 Trial
Hey,
In above example, why choose layer 3 switches instead of routers? Also, IP
SLA pings forever but at what time interval ping occurs?
Thanks,
AD
Lessons
[Link] 25/25