This article explains how to configure Hot Standby Router Protocol(HSRP). In this tutorial you will learn HSRP commands, metric and HSRP configuration.
It is a FHRP: First Hop Redundancy Protocol, which means they allow you to configure more than one physical router but it can still be seen as a single router.
First Hop means that any packet traveling out the network has its gateway as its first hop. It is protocol used for Gateway redundancy.
Now as an example assume if we have some computers connected in a LAN they can communicate using IP addresses.
For a computer in a LAN to communicate outside the network, we need a device called Router.
These protocols can run on the Router or the Layer 3 Switches.
In this article we will cover HSRP. Hot Standby Routing Protocol
– Is a Cisco Proprietary protocol
– Used only on Cisco devices
– Cisco Created it in 1994
– The default Hello Timer is 3 seconds
– The default Hold Timer is 10 seconds
– HSRP would allow multiple routers or switches (multi-layer) to work a as single Gateway.
– A Virtual IP address is used to achieve this redundancy.
– The Virtual IP address is configured on all the Routers or MLS ( Multi-layer Switches)
– All routers are assigned a single group( 0-255)
– Does not support Load-Balancing
– The Multicast Group IP : 184.108.40.206 ( version 1) and 220.127.116.11( version 2)
– It uses Transport number UDP 1985
– Supports IPv6
– The Group Virtual MAC address is 0000.0c07.acxx
Roles of Routers
– Active Router: The router that current serves as the Gateway.
– Standby Router: This is the router that acts as a backup to the Active router.
– Listening Router: All the routers that participate in HSRP are known as listening router.
We can have only one Active and one Standby router in a HSRP group.
Each device running these Protocols would send Hellos every 3 seconds, if it does not receive a response for 10 seconds, it assumes the router which did not send a Hello is dead after the hold time of 10 seconds expire. The role of a default gateway is taken over by the router that is available.
The hellos sent are like keepalives to know if the routers are functioning. If due to any reason the active router is not reachable and it fails, then the Standby / Backup router takes the role of Primary and a new Standby router will be elected.
The Selection of the Active or Standby (Backup) router is decided based on the ‘priority’. The priority ranges from 0-255 and the default is 100. The higher the priority the better chances of being elected as Primary. Thus, the router which has the highest priority will be elected as Primary; the 2nd best priority is selected as Backup.
In case of tie between the priority, i.e. If 2 routers have same priority, then the highest IP address on the HSRP’s interface gets elected as the Active Router.
The Virtual Router used has its own IP and MAC address. It is the Virtual IP address that needs to be configured on all the hosts as default gateway.The Virtual MAC is returned when a host sends a ARP request. The host is unaware of which router is actually doing the forwarding of traffic.The protocol (HSRP) takes the decision about which physical router will be acting as the Virtual Router and forward traffic and which one will be the standby. In case of a failure, the transition from standby to active is smooth without the end user knowing. The Virtual IP and Virtual MAC shifts from the Primary (which failed) to the standby (which is running) thus making it the new Primary.
On the host machines the gateway need not be changed as we have configured the VIP (virtual IP) as gateway and even though one router failed, the VIP is functional on the other router, thus passing traffic :).
In HSRP, the Virtual IP address is a normal IP address which we can assign as the VIP. The MAC address is a made up one which has one part of it variable that can be changed. From the 48 bits, in total for the MAC:
The first 24 bits are used for the vendor ID; in this case as HSRP is a Cisco Protocol, the first 24bits (0000.0c) show that the ID is assigned to Cisco.In continuation the next bits i.e. next 16 bits are for the well-known HSRP-ID. (07.ac) The variable part in the MAC, the last 8 bits (0b) represent the HSRP group number that is assigned by the admin. In the above address the group is 11 and thus the conversion to hexadecimal results in ‘B’.
HSRP like other routing protocols go through certain states before being set as one of the roles.
- Disabled: in this state the interfaces are not configured for HSRP or these interfaces are administratively down.
- Init: When an interface is brought up, it is in init state.
- Learn: When a routers waits for an Active router to send Hellos to learn the configured Virtual IP address
- Listen: If the virtual IP has been learnt but the router is not elected as either Standby or Active. These routers only listen for hellos and do not periodically send hellos.
- Speak: When the router is sending Hello packets while participating in the election for Active Router.
- Standby: The backup to an Active router which monitors the status by sending Hellos to the Active router.
- Active: This is the router that uses the Virtual IP to accept and forward traffic. The Hellos are exchanged with the Standby Router.
The Hellos used for keepalives are sent every 3 seconds. When HSRP is fully functional and converged, Hellos are exchanged only between the Active and Standby Router. During the election of the Active and standby also these hellos are exchanged (Speaking State)
Router0(config)# int fa0/0
Router0(config-if)# standby 11 ip 192.168.1.1
Router0(config-if)# standby 11 name HSRP_Lab
Router0(config-if)# standby 11 priority 100
The “standby 11” specifies the group to which the interface belongs in HSRP. The default priority is 100, but to change it we can use the command “priority 100”
Router1(config)# int fa0/0
Router1(config-if)# standby 11 ip 192.168.1.1
Router1(config-if)# standby 11 name HSRP_Lab
Router1(config-if)# standby 11 priority 150
Based on the configuration, router1 becomes the Active router as the priority is higher than Router0 (Priority 100)
The below commands can be used to verify the configurations:
show standby brief
- Routing and Routing Protocols
- Routing, Static Routing, Dynamic Routing
- Default Route and Static Routes Configuration