We’ve already wrote about the Hot Standby Router Protocol (HSRP) in our previous article. HSRP is a proprietary protocol developed by Cisco, that allows to decouple the IP addresses from the physical interfaces and to associate them to groups of interfaces, providing hardware redundancy.
In this article we’ll see how to balance the network load with the 2 HSRP groups, allowing to assign 2 virtual gateways to every group of PCs. The result will be a network scheme with load balancing that allows the 2 hosts to connect to the Internet even in case of failure of a gateway.
Let’s see the configuration of the R1 router.
This router will be Active for the group 1 with virtual IP 10.0.0.254 while it will be Slave for the group 2 with virtual IP 10.0.0.251. This can be achieved configuring the priority to 110 for the group 1 (default is 100):
R1(config)#interface fastEthernet 0/0
R1(config-if)standby 1 ip 10.0.0.254
R1(config-if)standby 1 priority 110
R1(config-if)standby 1 preempt
R1(config-if)standby 2 ip 10.0.0.251
Configure the R2 router as Active for the group 2 and Slave for the group 1:
R2(config)#interface fastEthernet 0/0
R2(config-if)standby 1 ip 10.0.0.254
R2(config-if)standby 2 ip 10.0.0.251
R2(config-if)standby 2 priority 110
R2(config-if)standby 2 preempt
Now we can check the status of HSRP and which router is Active and which is Standy with the command Show standby.
We can determine the route of the traffic basing on the router configured as gateway:
Run the command show standby brief from the R2 router to show synthetic data about the status of the protocol:
From the host 2, configure the gateway 10.0.0.251 (Active R2 10.0.0.253). With the command traceroute 18.104.22.168 we notice that the traffic passes through the R2 router, Active for the group 2 of the HSRP.
Let’s configure the host 1 to connect to the gateway 10.0.0.254 (Active R1 10.0.0.252). In this case the traffic passes through the R1 router, Active for the group 1 of the HSRP:
Now that the setup is ready, we’ll simulate the failure of the R2 router and check how the routing will be automatically adapted to preserve connectivity:
Automatically, the R1 router becomes Active for the group 2. The traffic from/to the host 2 passes through the physical gateway R1 (10.0.0.252) even if the host is still connected to the virtual gateway 10.0.0.251:
In fact, after the simulated failure of the R2 router, the R1 router has been configured Active for both the groups. You can check this with the Show standby command: