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. It is a redundancy protocol.
HSRP allows you to configure two or more routers as standby routers and only a single router as an active router at a time. All the routers in a single HSRP group shares a single MAC address and IP address, which acts as a default gateway to the local network. TheActive routeris responsible for forwarding the traffic. If it fails, theStandby routertakes up all the responsibilities of the active router and forwards the traffic.
HSRP uses a simple and straightforward concept. This concept is known as anactive/passive (standby)concept. The following steps describe this concept.
Before we explore this concept in more detail, let's briefly discuss HSRP terminology.
Virtual Router
A virtual router connects the local subnet to the main gateway router. The hosts of the local subnet forward data packets to the virtual router, and the virtual router forwards them to the destination. A virtual router is not a physical router. It is a role that is held by one member router of the HSRP group. In simple words, a virtual router is the currently active default router.
Active router
An active router is themainrouter. An active router is a physical router that plays the role of a virtual router. It receives the traffic from the local subnet and forwards that traffic to the destination.
Standby router
A standby router is thebackuprouter of the main router. If themainrouter fails, thestandbyrouter quickly takes over the responsibilities of themainrouter. In other words, if the main router fails, HSRP automatically transfers the role of the virtual router to the standby 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.
HSRP Configuration Process and Commands
Initial configuration
ConfigureRouter0 and Router1 as shown in the following image.
1.Take two router-PT, router 0 and router 1 and a device, PC-PT PC 0
2.Take a switch 2960-24TT
3.Establish connection through Cu- straight through from router 0 to switch 0 using Fa 0/0 and Fa 0/15, from router 1 to switch 0 using Fa 0/0 and Fa 0/18 and from PC 0 to switch 0 using Fa 0 to Fa 0/16
Router0 (main gateway router) configuration
Router>enable
Router#configure terminal
Router(config)#interface FastEthernet0/0
Router(config-if)#no shutdown
Router(config-if)# ip address 10.0.0.1 255.0.0.0
Router1 (backup gateway router) configuration
Router>enable
Router#configure terminal
Router(config)#interface FastEthernet0/0
Recommended by LinkedIn
Router(config-if)#no shutdown
Router(config-if)# ip address 10.0.0.2 255.0.0.0
In HSRP configuration we only need one command to configure the initial HSRP, and that command is the following.
Router(config-if)#standby group-id ip ip-address
You need to execute this command from thesub-configurationmode of the interface that provides the default gateway functionality. This command requires two parameters: group-id and ip-address. Thegroup-idis the group number of HSRP. Theip-addressis a virtual IP address that you want to use as the default gateway IP address.
You need to execute the same command on all interfaces (main interface and backup interfaces) that you want to use as a default gateway for the local subnet.
To configure HSRP on both interfaces, we will use the following command.
Router(config-if)#standby 1 ip 10.0.0.10
This command will set the HSRP group number to1and the virtual default gateway IP address to10.0.0.10. You can select any group number from the range0 - 4095. But after selecting the group number, use the same group number on both the main interface and backup interfaces.
We should select the virtual IP address that belongs to the IP subnet of the main physical gateway interface.
HSRP configuration of Router0 (main gateway router)
Router(config-if)#standby 1 ip 10.0.0.10
Router(config-if)#standby 1 priority 110
The router 0 changes to active state.
HSRP configuration of Router1 (backup gateway router)
Router(config-if)#standby 1 ip 10.0.0.10
The router 1 changes to standby state.
Verifying HSRP configuration
We can use the'show standby'command to view the current state of the router or know the HRSP group number and virtual IP address.
At Router 1,
At Router 0,
If HRSP is configured, HRSP automatically replaces the failed gateway router with an available standby router.
To make the Router 0 inactive (failed gateway router), we can use the 'shutdown'command.
The Router 0 changes to inactive state and goes back to the initialization stage.
Whereas, the Router 1 by default changes to active state as shown below.