Skip to content
  • There are no suggestions because the search field is empty.

Implementing HSRP

To implement HSRP, you need to add two or more routers or L3 switches to an HSRP group, where only one will operate as an active unit and another will be a standby device, ready to take over the active role when the active one fails. In the group, both devices share the same virtual IP address and MAC address. However, only the active device takes action on the received data traffic.

Two routers in an HSRP group with a virtual router

Let’s look at the image above to understand the implementation process. In this use case, we want to add two routers (R1 and R2) to an HSRP group 1, where R1 will serve the active role, process all endpoint traffic, reply to ARP request messages, and send hello messages to the standby device in the group. 

At the same time, R2 will be the standby device and only monitor the status of R1. The standby device has a lesser role, and only sends hello messages, listens for hello messages from the active device, and assumes the active role if the active device (R1) fails.

Configuring Basic HSRP 

The configuration process consists of only a few commands for basic HSRP functionality. In this example, we will focus only on configuring R1, but keep in mind that the configuration of R2 would be identical.

HSRP configuration example topology

The HSRP configuration is entered in the configuration mode of the interface that connects to the other device in the HSRP group. As you can see in the image above, this is interface FastEthernet0/1 on R1 that connects through switch SW1 to interface FastEthernet0/1 on R2. The IP address used on FastEthernet0/1 is 192.168.1.1, the virtual IP address is 192.168.1.254, and the router belongs to group 1. 

Note: Although the group numbers are locally significant, it is recommended to use the same number on the routers included in the HSRP group for easier management.

To configure HSRP, you need to use the standby group-number ip [virtual ip-address]. The following commands configure HSRP on R1:

Configuring HSRP on router R1

Because there are two versions of the HSRP protocol, a different format for the virtual MAC address is used. When using HSRP v1, only 256 groups are available, and the virtual MAC address uses the format 0000.0C07.ACXX, where XX represents the HSRP group number. HSRP v2 supports up to 4096 groups, and the MAC address has the format 0000.0C9F.FXXX, where XXX identifies the HSRP group.

The active and standby router selection is based on the higher priority number between 0-255, where 100 is the default value. When the priority number is the same, the device with the highest IP address becomes the active device in the HSRP group. 

The priority number is a configurable parameter, and you can change it to influence the election for the active device in the HSRP group. When there are more than two devices in an HSRP group, one is active, one is standby, and the other devices only listen and wait to become the new standby device. 

Enabling the Pre-emption Feature

When a failover happens, the standby device becomes active and does not revert to its initial standby role if the initially active router becomes active again. For the device with the highest priority to always be the active unit in the group, you need to enable pre-emption.

This feature is disabled by default, and you can use the ip address preempt command to enable it. The following commands enable the pre-emption feature and increase the priority of R1 from the default value of 100 to a higher (better) value of 120.

Configuring pre-emption on router R1 and changing the default priority value

Tuning HSRP Time Interval Settings

HSRP hello packets are exchanged between routers every 3 seconds, and the hold time interval is 10 seconds by default. When the hold time period expires, or in other words, when the standby device does not receive a hello packet within 10 seconds from the active device, it takes over the active role.

To speed up the failover process, you can lower the timers (the available range is between 1 and 255 seconds) on the devices in the HSRP group. In extreme cases, you can even configure timers in milliseconds instead of seconds. However, ensure the hold time is at least three times the hello time.

Note: Lowering the timers speeds up the failover process while increasing the bandwidth consumption and the possibility of flapping behavior. Using short intervals is not recommended in unstable networks.

The standby group-number timers [msec] hellotime [msec] holdtime allows you to change the default HSRP timers. You can define them in seconds which is the default parameter or in milliseconds.

For example, if you want the hello packets to be sent every 200 milliseconds and the hold time to be 750 milliseconds, you should enter the standby 1 timers msec 200 msec 750 command in the interface configuration mode.


To verify the HSRP configuration on R1, you can use the show standby command such as in the example output below:

Show standby command on a router and its output