HSRP
HSRP and HSRP for IPv6 are both Cisco-proprietary protocols which provides a way to avoid losing outside network access if the default/primary router fails.
These protocols, ensure high network availability by providing first-hop routing redundancy for IP hosts on networks configured with an IP default gateway address.
HSRP works in a group of routers allowing for the selection of an Active router and Standby routers. In such a group, the active router is the one that is used for routing packets; On the other hand, the standby router is the device that will take over when the active router fails, or when pre-set conditions are met.
An HSRP Standby router continuously monitors the operation state of the HSRP Group and will quickly assume packet-forwarding responsibilities in case the active router fails
HSRP Version
The most recent version of HSRP is version 2, by default version 1 will be applied so we will need to configure our devices to use version 2
Command to set HSRP version
R1(config)# interface [interface-id] R1(config-if)# standby version [version]
HSRP IP Addressing and Grouping
We’ll need to configure the IP address of the virtual default gateway. This address will be used by the hosts that require the services of the default gateway. This virtual IP address will start to be used as the default gateway on the host machines.
Many instances of HSRP can be configured on a router. We must always specify the HSRP group number to locate the virtual interface between routers in a HSRP group. This number must always be consistent between the routers in the same group.
Command to configure group number and IP Addressing (default-gateway)
R1(config-if)# standby [group] ip [ip-address]
HSRP Priority and Preemption
The roles (active/standby routers) is determined via an HSRP election process. By default, the router with the highest IPv4 address will be elected as the active router.
Instead of letting the process automatically determine a Master router via IPv4 address, it is highly recommended to manually control how the network will operate under normal conditions.
To do so we can tamper with the HSRP priority and Preemption states.
HSRP Priority
We configure what’s called and HSRP Priority to determine the active router. The router with a highest priority will become the active router.
By default, the priority is automatically set to 100. If all priorities on all routers are equal (default) then, the router with the highest IPv4 address will be elected as the active router. The priority range varies from 0 to 255.
To configure a router to be the active router, use the following commands
Command to configure the priority
R1(config-if)# standby [group] priority [number]
HSRP Preemption
By default, once a router becomes the active router, it will remain the active router even if another router comes online with a higher HSRP priority.
If we specifically want a higher-priority router to become the active router whenever it becomes online, we will need to force an HSRP election process. This is where preemption comes in.
Preemption is the ability of an HSRP router to re-trigger an election process when it comes online. If preemption is enabled and a router with a higher HSRP priority comes online, that router will become the active router once again.
A router enabled for preemption, with equal priority but a higher IPv4 address will not preempt an active router, thus priority rating is of utmost importance and the active router must always have a higher priority
Command to configure preemption
R1(config-if)# standby [group] preempt
Configuring router priority and preemption Complete Configuration Example
R1> enable R1# configure terminal R1(config)# interface interface g0/1 R1(config-if)# standby version 2 R1(config-if)# standby 1 ip 192.168.1.254 R1(config-if)# standby 1 priority 150 R1(config-if)# standby 1 preempt R1(config-if)# exit R1(config)# exit R1#