Hot Standby Router Protocol (HSRP) is a CISCO proprietary protocol, which provides redundancy for a local subnet. In HSRP, two or more routers gives an illusion of a virtual router.
HSRP allows you to configure two or more routers as standby routers and only a single router as active router at a time. All the routers in a single HSRP group shares a single MAC address and IP address, which acts a default gateway to the local network. The Active router is responsible for forwarding the traffic. If it fails, the Standby router takes up all the responsibilities of the active router and forwards the traffic.
Some important terms related to HSRP :
- Virtual IP : IP address from local subnet is assigned as default gateway to all local hosts in the network.
- Virtual MAC address : MAC address is generated automatically by HSRP. The first 24 bits will be default CISCO address (i.e. 0000.0c). The next 16 bits are HSRP ID (i.e. 07.ac). The next 8 bits will be the group number in hexadecimal. e.g- if the group number is 10 then the last 8 bits will be 0a.
Example of virtual MAC address –
- Hello messages : Periodic messages exchanged by active and standby routers. These messages are exchanged after every 3 seconds telling the state of router.
- Hold down timer : Its default value is 10 seconds i.e roughly 3 times the value of hello message. This timer tells us about the router that how much time will the standby router waits for hello message if it is not received on time.
Note : If the active router fails then the standby router will become the active router.
- Priority : By default, the priority value is 100. It is helpful when the active router comes back after falling down, we can change the priority of standby router (which has become the active router after the original active router is down) to less than 100 therefore it again becomes standby router.
Note : The router having higher priority will become the active router.
- Preempt : It is a state in which the standby router automatically becomes the active router.
Members having same group ID are the members of same group. One of the member of the group will be elected as the active router while others remain as standby routers. The virtual IP is configured as default gateway of all the hosts in the local subnet and the active router is responsible for forwarding the traffic of local hosts. If the active router goes down then the hello messages are not exchanged between the active and the standby routers therefore the standby router waits until the hold down timer time. As soon as the hold down time is finished, the standby router will become the active router and takes up all the responsibilities of active router. This is known as preempt.
If in case the original active router comes back then we can decrease the priority of the standby router so that it will become the standby router again.
Hot Standby Router Protocol (HSRP) has 2-versions :
version 1 : The messages are multicast at 188.8.131.52 and uses the UDP port 1985. This version allows group number range from 0 to 255.
version 2 : The messages are multicast at 184.108.40.206 and uses the UDP port 1985. This version allows group number range from 0 to 4095.
Consider above given topology. There are 2 routers named R1 and R2. IP address of R1 (f 0/0) is 10.1.1.1/24 and R2 (f 0/0) is 10.1.1.2/24.
Assigning IP address to router R1.
r1#(config) int fa0/0 r1#(config-if)ip add 10.1.1.1 255.255.255.0
Assigning IP address to router R2.
r2#(config) int fa0/0 r2#(config-if)ip address 10.1.1.2 255.255.255.0
Now, Let’s provide virtual IP address (10.1.1.100), group name HSRP_TEST, group number 1and priority 110. Also, preempt has been enabled i.e. if the active router goes down then the standby router automatically becomes the active router.
r1#(config-if) standby 1 ip 10.1.1.100 r1#(config-if) standby 1 name HSRP_TEST r1#(config-if) standby 1 priority 110 r1#(config-if) standby 1 preempt
Now, we will provide virtual IP address (10.1.1.100), group name HSRP_TEST and priority 100. Also, group number 1 and preempt has been enabled.
r2#(config) int fa0/0 r2#(config-if) standby 1 ip 10.1.1.100 r2#(config-if) standby 1 name HSRP_TEST r2#(config-if) standby 1 priority 100 r2#(config-if) standby 1 preempt
Note : As we have provided priority 110 to r1, therefore it will become the active router.
- Hot Standby Router Protocol (HSRP) and Virtual Router Redundancy Protocol (VRRP)
- Introduction of Virtual Router Redundancy Protocol (VRRP) and its configuration
- Difference between Stop and Wait protocol and Sliding Window protocol
- Difference between Serial Line Internet Protocol (SLIP) and Point-to-Point Protocol (PPP)
- Difference between File Transfer Protocol (FTP) and Secure File Transfer Protocol (SFTP)
- Introduction of a Router
- Configuration of Router on a stick
- Difference between Router and Switch
- Difference between Bridge and Router
- Difference between Modem and Router
- Cisco Router modes
- Cisco Router basic commands
- Backing up Cisco IOS Router image
- Open shortest path first (OSPF) router roles and configuration
- Network Devices (Hub, Repeater, Bridge, Switch, Router, Gateways and Brouter)
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : saurabhsharma56