Page Content

Tutorials

Cisco Hot Standby Router Protocol HSRP Configuration, States

Hot Standby Router Protocol (HSRP): How it works, Failover Process, Messages and Timers, Versions and Addressing, Election and Preemption, Load Balancing, Interface Tracking, HSRP configuration, States, and Misconfiguration Troubleshooting were all covered in this blog.

What is HSRP Hot Standby Router Protocol?

A Cisco proprietary protocol called HSRP (Hot Standby Router Protocol) uses a virtual IP and MAC address shared by several routers to create a local network’s default gateway that is fault-tolerant. To ensure network availability and avoid a single point of failure, one router is designated as the “active” gateway to forward traffic, and a “standby” router takes over in the case that the active one fails.

Hot Standby Router Protocol
Hot Standby Router Protocol

How does HSRP work?

The active/standby (or active/passive) concept is how HSRP functions. In this arrangement, end-user traffic is only ever actively forwarded by a single router.

A virtual router serves as the one default gateway address for all end devices in the fundamental mechanism.

Group and Addressing:

When a router is set up with HSRP, it is assigned to a particular HSRP Group Number, such as Group 1. After that, this group receives a virtual IP address and a virtual MAC address (for example, 0000.0C07.ACxx, where ‘xx’ is the group number) automatically.

State Election:

Using Hello messages, the group’s routers choose the Active and Standby routers according to priority (the router with the highest priority wins; by default, it is 100). The router with the highest IP address prevails if priority are equal.

Host Configuration:

The virtual IP address is set up as the default gateway for every host on the subnet.

Forwarding Traffic:

  • The virtual MAC and virtual IP are assumed by the active router.
  • The Active Router provides the Virtual MAC in response to an ARP request for the Virtual IP sent by a host sending traffic to its default gateway.
  • The Active Router receives all traffic intended for the default gateway.

Failover:

The Standby Router takes over the function of Active, takes over the Virtual IP and MAC addresses, and starts forwarding traffic if the Active Router is unable to transmit Hello messages during the Hold Time (10 seconds by default). The end hosts are aware of this failover.

Also Read About The Benefits Of Subnetting And Why Is Subnetting Important

HSRP Failover Process

The standby router recognizes the failure of the active router by observing that there are no regular Hello messages.

  • Both the virtual IP address and virtual MAC address are taken over by the backup router, which acts as the forwarding router.
  • A gratuitous ARP (ARP reply transmitted as a broadcast without an initial request) is issued by the newly active router. In order to reflect the proper port leading to the virtual MAC address (now on the new active router), this message compels the switches on the subnet to update their MAC address tables.
  • End devices typically don’t notice this failover procedure since they keep their ARP table entry for the virtual MAC address and their default gateway setting (the virtual IP address).

HSRP Messages and Timers

Multicast messages are used for communication between HSRP routers.

  • Protocol and Port: UDP port 1985 is used for communication between HSRP routers.
  • Hello Timer: The frequency of Hello messages sent by routers. Three seconds is the default interval.
  • Hold Timer: The amount of time that the standby router waits before switching to the active role in the event that it fails to receive Hello packets. Ten seconds is the default hold period, which is about three times the hello timer’s usual duration.
  • Active Timer: Keeps track of the active router’s status, expiring according to the hold time value and restarting upon receiving a hello packet.
  • Standby Timer: Keeps track of the standby router’s status, resets when it receives a Hello packet from it, and expires according to the hold time value.

Also Read About Advantages, Disadvantages Of Routers & How Do Routers Work

HSRP Versions and Addressing

Version 1 (default) and Version 2 (HSRPv2) are the two HSRP versions that Cisco IOS supports. The version must be the same for routers in the same HSRP group.

FeatureHSRP Version 1HSRP Version 2
IPv6 SupportNoYes
Group Number Range0 to 255 (256 groups)0 to 4095 (4096 groups)
IPv4 Multicast Address224.0.0.2 (UDP 1985)224.0.0.102 (UDP 1985)
Virtual MAC Address Base0000.0C07.ACxx (xx is group number)0000.0C9F.Fxxx (xxx is group number)
Hello Timer ResolutionSecondMillisecond

Election and Preemption

Which router becomes the active router is decided by the router election process:

  • Priority: The election is won by the router with the highest configured priority. 100 is the priority value by default.
  • Tiebreaker: The router with the highest numerical IPv4 address becomes the active router if priorities are equal or set to default. The router with the highest priority wins if both are up at the same time. The first router that is configured usually becomes active if the priorities are the same.

Preemption

By default, a router with a higher priority will stay in the standby state if it comes online after an election has already taken place.

  • Preemption needs to be set up in order for a higher-priority router to take over the active role from a lower-priority active router.
  • Standby group preempt is the command to enable preemption.

HSRP Load Balancing

Since the core function of HSRP is active/standby, routers typically do not divide the burden among themselves. In contrast to GLBP, HSRP is not regarded as a true load-balancing method.

However, by setting up many HSRP groups across various VLANs or subnets, HSRP can do load sharing, often known as load balancing. For VLAN 10 (HSRP Group 1), for instance, one router can be set up as the active router, and for VLAN 20 (HSRP Group 2), another router can be set up as the active router.

Interface Tracking

  • Interface tracking makes ensuring that the active router’s capacity to connect to external networks is reflected in the HSRP status.
  • HSRP monitors and lowers the priority of the active router in the event that an upstream interface (such as a serial link to an ISP) breaks.
  • Ten is the default decrement value.
  • This lower priority essentially moves the default gateway function to the path with active upstream connectivity, allowing the standby router, whose priority stays high, to take on the active role.

The standby group track interface-id command is used to configure interface tracking.

Also Read About Hot Standby Router Protocol, How HSRP Works & Applications

HSRP configuration

HSRP configuration
Image Credit To Napkin.AI

Important commands for diagnostics and verification consist of:

The standby group ip virtual-ip-address command is the very minimum needed to configure HSRP on an interface.

CommandPurpose
show standbyDisplays detailed HSRP status, including timers, virtual MAC address, and state changes.
show standby briefDisplays pertinent information in a summarized format, showing the group number (Grp), priority (Pri), state, active/standby router IP addresses, and the virtual IP.
debug standbyAllows viewing of real-time HSRP diagnostics, including state transitions.

HSRP States

HSRP interfaces go through a number of distinct states:

  • Initial (INIT): The start state, which is typically entered when an interface becomes accessible or when configuration changes, and indicates that HSRP is not running.
  • Learn: The router has not yet received an authorised Hello message from the active router and has not ascertained the virtual IP address.
  • Listen: Although it is not the active or standby router, the router is aware of the virtual IP address and keeps an ear out for Hello messages.
  • Speak: The router actively takes part in the election process and occasionally sends out Hello messages.
  • Standby: The router delivers sporadic Hello signals and is a contender to become the next active router.
  • Active: The router is sending out Hello messages on a regular basis and forwarding packets sent to the virtual MAC address.

Troubleshooting Misconfigurations

The following are typical HSRP misconfiguration problems that frequently cause both routers to become active and perhaps generate duplicate IP address warnings:

  • HSRP routers are either not set up with IPv4 addresses from the same subnet or are not linked to the same network segment.
  • Various virtual IPv4 addresses are set up on HSRP routers.
  • HSRP routers with various HSRP group numbers set up.
  • Different HSRP versions are configured on HSRP routers (e.g., v1 and v2 mismatch).
  • HSRP Peers cannot see one another because access lists block hello packets.
  • The endpoints are set up using the wrong default gateway address.

Also Read About Importance Of Endpoint Security, Advantages & Disadvantages

Hemavathi
Hemavathihttps://govindhtech.com/
Myself Hemavathi graduated in 2018, working as Content writer at Govindtech Solutions. Passionate at Tech News & latest technologies. Desire to improve skills in Tech writing.
Index