Host Standby Router Protocol (HSRP) is a Cisco-proprietary redundancy protocol configured on Cisco router inform of a “virtual” router as a backup for routing access.
This backup virtual router (HSRP) provides users at the access layer with uninterrupted service to the network if the primary gateway becomes inaccessible.
After configuring the IP address on the interface, use the standby group-number ip ip-address command to configure HSRP.
The group number can be any value between 0 and 255 in HSRPv1 and must be the same configuration on neighbouring routers.
In HSRPv2, the group number can be any value between 0 and 4095.
The IP address configured is that of the virtual router IP address for the HSRP group. It must be identical on all routers in an HSRP group.
Each standby group has its own active and standby routers. Assigning a priority value to each router in a standby group help in controlling the order in which active routers for that group are selected.
During the selection process, the router with the highest priority in an HSRP group becomes the active router. If in the event of all the routers having same priority, the router with the highest configured IP address becomes the default active router.
However, if the routers do not have the preempt configured, any router that boots up faster than the others in the standby group becomes the active router, regardless of the configured priority.
Although, you can still activate the former active router to resume the forwarding role by configuring the preempt command with a lower priority.
Using the diagram above we are going to configure R1 and R2 for HSRP using the virtual IP address of 10.1.20.1
R1 will be configured as the Active HSRP default-gateway and R2 will be configured as Standby.
The Preempt command is configured on both routers.
HSRP on R1
R1(config)# interface Gi0/0
R1(config-if)# ip address 10.1.20.2 255.255.255.0
R1(config-if)# standby 1 ip 10.1.20.1
R1(config-if)# standby 1 priority 110
R1(config-if)# standby 1 preempt
HSRP on R2
R2(config)# interface Gi0/0
R2(config-if)# standby 1 ip 10.1.20.1
R2(config-if)# standby 1 preempt
After configuration, give a few moment and use the show standby and show standby brief commands on R1 and R2 to verify that HSRP your configuration.
R1 should be the Active router and R2 should be Standby.