Hot Standby Router Protocol (HSRP) is a Cisco proprietary protocol developed for a gateway redundancy of a subnet. HSRP use multiple routers together to serve as one gateway using one virtual IP address. One of the routers will work as the active gateway, and in case the active router becomes unreachable, other routers will become active gateway instead.
In this article will guide you how to configure HSRP on two Cisco routers.
In this article, it is supposed that:
a. You have two Cisco routers hardware.
b. You have a direct console access to both Cisco routers.
3. Network Diagram
We will set up the HSRP on two Cisco routers using the following diagram. The virtual IP, 10.0.0.3, which is the gateway for network 10.0.0.0/24 is active on R1 and in case that R1 fails for some reason, R2 will becomes the active gateway automatically without any downtime.
4. Configure R1
The following are the commands to be executed on R1.
# conf t # int f0/0 no sh ip add 10.0.0.1 255.255.255.0 standby 10 ip 10.0.0.3 standby 10 preempt standby 10 priority 110
The command standby 10 ip 10.0.0.3 add R1 to HSRP group number 10 using IP address of 10.0.0.3 as the the virtual IP.
The command standby 10 priority 110 will set the priority number on R1 to 110. If we do not specify a priority the default priority number is 100. The router with a higher priority number will become the active router. For our case now, we want R1 the active gateway router.
The command standby 10 preempt ensuring that R1 will take back the active gateway role from R2 when it comes back alive after an event that triggers HSRP failover.
5. Configure R2
The following are the commands to be executed on R2.
# int f0/0 no sh ip add 10.0.0.2 255.255.255.0 standby 10 ip 10.0.0.3 standby 10 priority 90
On R2 we set the priority number to 90 which is lower then priority number that we set on R1, so R2 is the standby gateway.
6. Verify the Configuration
We can use the following command to verify HSRP configuration and below the out put on R1.
# sh standby brief P indicates configured to preempt. | Interface Grp Pri P State Active Standby Virtual IP Fa0/0 10 110 P Active local 10.0.0.2 10.0.0.3
And below the out put on R2.
# sh standby brief P indicates configured to preempt. | Interface Grp Pri P State Active Standby Virtual IP Fa0/0 10 90 Standby 10.0.0.1 local 10.0.0.3
We can test ping from computer client to the virtual IP of the HSRP group number 10 and we should get a successful result as the following.
C:\Users\techspacekh>ping 10.0.0.3 Pinging 10.0.0.3 with 32 bytes of data: Reply from 10.0.0.3: bytes=32 time=4ms TTL=64 Reply from 10.0.0.3: bytes=32 time=3ms TTL=64 Reply from 10.0.0.3: bytes=32 time=4ms TTL=64 Reply from 10.0.0.3: bytes=32 time=10ms TTL=64 Ping statistics for 10.0.0.3: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 3ms, Maximum = 10ms, Average = 5ms
Now you should be able configure HSRP on Cisco router. I hope that you can find this instruction informative. If you have any questions or suggestions you can always leave your comments below. I will try all of my best to review and reply them.