What is HSRP: Your Ultimate Guide To Network Fail-over
Introduction
Today’s enterprise network wants to ensure 24/7 network availability for its users. Redundancy is a key feature of today’s network. Moreover, Redundancy helps us to ensure availability and minimize downtime for maintaining the smooth running of network operations. One of the main and famous redundancy protocols is the Hot Standby Router Protocol (HSRP) which was developed by Cisco. So what is HSRP? It helps us to provide network availability by allowing multiple routers to work together and provide a resilient gateway for end users.
What is HSRP?
HSRP, or Hot Standby Router Protocol, is a network of high-availability protocols developed by Cisco in 1998. It ensures IP traffic flow by providing a backup router if the primary router goes down. It can allow multiple routers to work together in a group and it selects one router as an active router. All the other routers act as backup routers and are ready to take over if the primary or active router fails to forward IP traffic.
All the HSRP-configured routers will share a single virtual MAC address and Virtual IP address. This virtual IP address will act as a default gateway for all the internal end devices.
It works with other IGP protocols like RIP, EIGRP, or OSPF and its main objective is to eliminate a single point of failure at the default gateway level.
HSRP Versions:
There are two main versions; which are version 1 and version 2.
HSRP V1: This is the first and default version of the HSRP. Normally, it works with Ipv4 and uses a multicast IPv4 address 224.0.0.2. We can configure 0 to 255 group members in it. Moreover, it has a virtual MAC address 0000.0c07.ac01.
HSRP V2: The second version has enhanced the HSRP. However, it uses another multicast IP address 224.0.0.102, and the group member ranges from 0 to 4095. IPv6 was not supported in the first version, however,, version 2 supports IPv6 and provides better scaling in large networks. While it has a virtual MAC address: 0000.0C9F.FXXX.
HSRP Priority
HSRP priority decides which router will become an active router and forward the traffic. The default priority is 100, however, you can change its value. Moreover, if two routers have the same priority value, then the router with the highest IP address will become active, and the router with lower IP will act as a standby router.
HSRP preempt
Preempt allows a router with higher priority to take over if it recovers from failure. When the active router becomes unavailable due to some reason, then the HSRP preempt command enables it to take over as active if it starts its operations back.
Key Concepts and Terminologies
There are some key concepts of the HSRP Protocol which are given below:
1) HSRP Group: We configure the HSRP protocol on a group of routers that share a single virtual IP address and virtual MAC address. Those HSRP-configured routers respond to ARP requests on behalf of the active router.
2) Virtual IP Address: Virtual IP addresses are not directly configured on a router interface, but it is configured under HSRP configuration. The end devices use this virtual IP address as their default gateway. All the routers share this IP address, but only the active router responds to the end devices if it wants to send data on the internet.
3) Virtual MAC address: Just like a virtual IP address, it also shares a virtual MAC address which is generated by HSRP. The virtual MAC address is divided into three main portions, which are given below:
0000.0c 07.ac 0a and this is the HSRP v1 virtual mac address:
While HSRP v2 has a virtual MAC address is 0000.0C9F.FX01.
4) Active Router: It is a type of router that is currently responding to the end devices and forwarding packets across the internet. A backup router will take over if the active router goes down. An active router is selected based on the priority value.
5) Standby Router: A backup router will take over the active router if the active router goes down. This backup router is known as a standby router. The standby router constantly monitors the active router.
6) Hello Packets: The status of the active router is determined by the hello packets. A hello packet is sent using a multicast IP address at regular intervals, which is 3 seconds.
7) Priority: We select the router as active or standby based on priority. A higher priority value will select a router as an active router. While the lower priority value router will be elected as a standby router. By default, the priority value is 100, but you can change it.
7) Preemption: Preemption is a great feature, which allows a router with a higher priority to take over as the active router if it recovers from a failure.
How does HSRP Work?
HSRP Protocol elects an active router and standby router from a group of routers. But, how it elects active and standby routers. Here’s below is its way of working:
1) Election Process: HSRP-speaking routers exchange their hello messages after a fixed interval of time. The hello message includes a priority value that decides the active and standby router. The router with the higher priority value will be elected as an active router, while the router with the lower priority value will be elected as a standby router.
2) Standby and Fail-over: The standby router constantly monitors the active router through the use of hello messages. If it doesn’t receive any hello for a specified time, then it will take over the active router and elect itself as an active router.
3) Load Sharing: The working of HSRP doesn’t provide only redundancy, but it also provides load sharing. We use load sharing by the use of different HSRP groups. Each group is associated with its respective vlan.
HSRP States
HSRP routers go through various states during the election and fail-over process.
1) Initial: In the initial state, the router is taking part in HSRP.
2) Learn: After the Initial state, the next phase is the Learning state, where the router is waiting to learn the virtual IP address.
3) Listen: Now the router has learned the virtual IP address, but till now it is neither active nor standby router
4) Speak: When it reaches the speaking state, then it can participate in the election process.
5) Standby: The router becomes a backup or standby router and is ready for the active state if the currently active router goes down.
6) Active: The standby router elects itself as an Active router, in case of an active router failure.
HSRP Configuration Lab
Our lab topology consists of five routers, three switches, one server, and 6 PCs in an internal network. Before going.
- Configure all the IP addresses as in the screenshot
- Run EIGRP on all the routers
- Ping the devices from each other to test connectivity
Configure HSRP on Router R1.
Through standby, we are configuring HSRP while 1 is the HSRP group number and 192.168.10.100 is the virtual IP address. It will act as a default gateway for all the internal devices.
We set the priority as 180. All the other routers that have lower priority than this will act as backup routers (standby routers). Moreover, the preempt command will enable it to take over if it recovers from failure. At the last, we have configured hello and dead time intervals.
Now configure HSRP configuration on R2:
Check the default gateway:
R1 acts as an active router and R2 acts as a standby router.
Now configure a default gateway on all the PCs. The virtual IP address will act as a gateway.
Ping R5 from the internal PC1.
disable the R1 interface Fa 0/0.
Now again ping R5 from the PC1, to check connectivity.
If we enable the R1 interface fast ethernet 0/0.
Wait for a few seconds, then run the “show standby brief” command to check active and standby routers.
R1 has taken over R2 and becomes Active Router again. R2 acts as a backup or standby router.
Interface Tracking Command
Interface tracking is a simple feature that allows a router in a standby group to automatically adjust its priority based on whether its interfaces are on or off. If an interface goes down, the router’s priority drops, and another router takes over the system without any problems.
With HSRP tracking, when a critical interface is unavailable on a router, the router backs off. It allows another router to become active so that the network continues to operate without major disruptions.