HSRP or hot standby routing protocol provides network redundancy solutions to routers.By configuring HSRP in a number of routers in a network you can offer your customers the opportunity to enjoy seamless network or Internet access opportunity. HSRP is mainly used in the perimeter network or in a network where high-available is a must or has zero tolerance to network downtime.
How HSRP provide redundancy?
In HSRP, only one router takes the active role to forward the traffic and other routers just listen to the port of that active route. If the active router’s port goes down or link fails, then the router with the second highest level of priority takes control of the job of forwarding traffic. In the meantime, if the failed router comes back to online then it takes back its role once again as an active router. To the users any kind of interface or link failure to the HSRP router will remain transparent becasue the network users will only see a virtual IP that represents all the routers in a HSRP active or standby router group. It does not matter which router is active or which one is standby, the users only need to configure the virtual IP as the default gateway to their devices.The process of HSRP redundancy is as follows:
- A group of router is configured with a virtual IP in their interfaces that are connected to the internal networks
- Each router has its own priority. The highest priority router is elected as the active router and the router with the next higher priority works as standby and so on.
- When active router fails and the standby router takes the role of active router.
- When a failed router in a HSRP group comes back to operation, it seizes its role as a active router back from the current active router.
What is Preemption?
Preemption is a process by which a HSRP router with highest level of priority becomes an active router. In case of failure of the active router, the router with the next highest priority will be the active router for forwarding packets. The priority range of HSRP is 0-255.When an active router fails and again becomes online, it will not be elected as an active router once again unless you use the preempt command.
In the following HSRP Configuration scenario you need to configure HSRP in three routers , where router number 5 will take the active router’s role.In case of a failure to this router, the router number 3 will become the active one, and the router 7 become active when both router 5 and 3 are down.
Router 5 configuration
Router5#interface Ethernet e0
Router5(config-if)#standby 1 ip 18.104.22.168 255.255.255.0
Router5(config-if)#standby 1 priority 200
Router5(config-if)#standby 1 preempt
Router5(config-if)#standby 1 authentication myhsrp
Router5(config-if)#standby 1 track S0 110
In the above configuration of HSRP in the router 5, the priority is 200 and 22.214.171.124 is the virtual IP that will remain transparent to the all the hosts in VLAN 2. All users of VLAN 2 will set their default gateway as 126.96.36.199 . No matter which router is active, the users can keep continue their normal operation and send traffic to the outside network and in the Internet. The last command, track S0 will keep tracking the status of the serial 0 interface of router 5, and in case of failure of this interface it will decrease the priority of this router by 110 from its original priority setting 200. The authentication command will enable authentication in the HSRP group, thus reducing the risk of any rouge router joining this HSRP group.
Router 3 configuration
Router3# interface Ethernet e0
Router3(config-if)#standby 1 ip 188.8.131.52
Router3(config-if)#standby 1 priority 150
Router3(config-if)#standby authentication myhsrp
Router3(config-if)#standby 1 track s0 60
Router 7 configuration
Router7# interface Ethernet 1/0
Router7(config-if)#standby 1 ip 184.108.40.206
Router7(config-if)#standby 1 priority 100
Router7(config-if)#standby 1 preempt
Router7(config-if)#standby 1 authentication myhsrp
You do not have to add any tracking command since router 7 will be the last preferred router in the HSRP group with the least level of priority.
HSRP Router Hello Timer Configuration
For instance you want to configure the hello time for 5 seconds and hold down timer for 10 seconds. Configure the timer in the interfaces that are connected to the local VLAN
Router5(config)#interface Ethernet e0
Router5(config-if)#standby 1 timer 5 10
Router3(config)#interface Ethernet e0/0
Router3(config-if)#standby 1 timer 5 10
Router7(config)#interface Ethernet e1/0
Router7(config-if)#standby 1 timer 5 10