What is HSRP (Hot Standby Router Protocol)?

The Hot Standby Router Protocol (HSRP) is a CISCO proprietary protocol that offers local subnet redundancy. In HSRP, the illusion of a virtual router is created by two or more routers.

With HSRP, you can set up two or more routers as backup routers and just one router as active at once. A single MAC address and IP address are shared by all the routers in a single HSRP group and serve as the default gateway to the local network. The traffic must be forwarded by the Active router. If the current router fails, the standby router assumes all duties and forwards the traffic.

The Hot Standby Router Protocol does this by acting as a Gateway of numerous routing alternatives using a Virtual IP address and a MAC address. The traffic is always routed to the Virtual IP address, which serves as the Virtual Gateway. As a result, the traffic flow is unaffected by a device. This eliminates single point of failure for networks.

By the way, the HSRP Group numbers are mentioned at the start of the configuration after the “standby” keyword. An interface can have numerous Hot Standby Router Protocol groups.

Working

Members with the same group ID belong to the same group. One of the group members will be chosen as the active router, while the rest will serve as standby routers. The virtual IP is set as the default gateway for all hosts in the local subnet, and the active router is in charge of forwarding traffic from local hosts. If the active router fails, no greeting messages are exchanged between the active and standby routers, therefore the standby router waits until the hold-down timeout expires. When the hold-down timer expires, the standby router becomes the active router and assumes all of the active router’s tasks. This is known as preempt.

If the original active router returns, we can reduce the priority of the backup router, making it the standby router once more.

Some important terms related to HSRP:

Virtual IP: An IP address from the local subnet is assigned to all local hosts in the network as the default gateway.

Virtual MAC address: HSRP generates MAC addresses automatically. The first 24 bits will be the standard CISCO address (i.e. 0000.0c). The following 16 bits constitute the HSRP ID (i.e. 07. ac). The next 8 bits will be the hexadecimal group number. For example, if the group number is 10, the last eight bits will be 0a.

Greetings (Hello) messages: Active and standby routers exchange messages on a regular basis. These messages are exchanged every 3 seconds and inform the router’s status.

Hold down the timer: The default value is 10 seconds, which is nearly three times the value of the hello message. This timer notifies us about the router and how long the standby router will wait for the hello message if it is not received on time.

Priority: The priority value is set to 100 by default. When the active router returns after being down, we can alter the priority of the standby router (which has become the active router after the original active router is down) to less than 100, causing it to revert to standby mode.

Please keep in mind that the router with the highest priority will become the active router.

Preempt: This is a state in which the standby router takes over as the active router.

Router Roles in HSRP

HSRP Groups are used by the Hot Standby Router Protocol. There are different routers with varied roles for each group. These are the roles:

  • Active Router
  • Standby Router
  • Listening Routers

Active Router: The Active Router is the router through which the traffic flows. Active traffic flow is provided by the router.

Standby Router: The Standby Router serves as the Active Router’s backup. When the active router fails, this router becomes active, and all traffic is routed through it.

Listening Routers: Finally, the Listening Routers are the additional routers that are involved in the HSRP.

There are two variants of the Hot Standby Router Protocol (HSRP):

Version 1: The messages are multicast at 224.0.0.2 and use UDP port 1985 in version 1. The group number range in this version is 0 to 255.

Version 2: The messages are broadcast to 224.0.0.102 on UDP port 1985. The group number range in this version is 0 to 4095.