Hot Standby Routing Protocol ( HSRP ) Introduction
19 Feb 2012In the following article I’ll make a brief introduction over HSRP and a simple lab topology to show its basic utility. HSRP is Cisco’s proprietary protcol which provides non-disruptive IP traffic failover when you’ve got multiple redundant gateways for you LAN segment.
Let’s get back to the basics and remember how 2 hosts communicate on a local subnet: one host broadcasts an ARP request on the local segment, receives the reply, updates its mac address table and then sends frames directly to the learned mac address. When 2 hosts are located on different subnets a router - the default gatway is needed to route packets between the subnets. In this case the hosts operating system checks the destination IP address, sees that it’s not part of the local subnet and tries sending the frame to the default gateway. In order to do that the host first sends an ARP request asking for the mac-address associated to IP address of the default gateway and after it receives it caches the mac address and sends all the frames through the default gateway.
Now HSRP comes in place where you have multiple default gateways but still on the hosts you can configure a single default gateway. What HSRP does is that it logically groups the multiple gateways providing a virtual IP and mac address for this group. The group can be formed out of a minimum of 2 devices - one of them will be the active gateway and the other one will be in standby mode . The election is based on a priority value ( 0 - 255 ) and the router with a higher priority is elected as the active one. The default priority is 100 and if both the devices have the same priority the one with a higher IP address becomes the active router. The routers exchange hello messages at regular time intervals so that they can be aware of each others state.
Let’s have a look at a simple HSRP topology and see how we can configure basic functionality of the protocol. As you may see we’ve got 2 LAN segments connected through 2 L3 switches. The HSRP group is configured per interface and as you can see we’ve got HSRP group 0 for both of our LAN segments. This perfectly valid because the HSRP groups are locally significant only on an interface. The virtual IP address is set per interface and it needs to be the same for all the routers in the group and the virtual mac address is formed by 0000.0c07.acxx where xx is the HSRP group number as 2 hex digits.
In our scenario we will not configure any priority so the elected active router will be the one with the interface which has the higher IP address: GW_2 in our case.
That should be all you have to configure for basic HSRP. More detailed examples to follow where we shall tune the hello timers, configure authentication methods between the group members and try to load balance the traffic with the help of HSRP.