End devices are typically configured with a single default gateway IPv4 address.
First hop redundancy protocols (FHRPs) are mechanisms that provide alternate default gateways in switched networks where two or more routers are connected to the same VLANs.
One way to prevent a single point of failure at the default gateway is to implement a virtual router. To implement this type of router redundancy, multiple routers are configured to work together to present the illusion of a single router to the hosts on the LAN. By sharing an IP address and a MAC address, two or more routers can act as a single virtual router.
When the active router fails, the redundancy protocol transitions the standby router to the new active router role, as shown in the figure. These are the steps that take place when the active router fails:
1.The standby router stops seeing Hello messages from the forwarding router.
2.The standby router assumes the role of the forwarding router.
3.Because the new forwarding router assumes both the IPv4 and MAC addresses of the virtual router, the host devices see no disruption in service.
Cisco provides HSRP and HSRP for IPv6 as a way to avoid losing outside network access if your default router fails. HSRP is a Cisco-proprietary FHRP that is designed to allow for transparent failover of a first-hop IP device.
HSRP ensures high network availability by providing first-hop routing redundancy for IP hosts on networks configured with an IP default gateway address. HSRP is used in a group of routers for selecting an active device and a standby device. In a group of device interfaces, the active device is the device that is used for routing packets; the standby device is the device that takes over when the active device fails, or when pre-set conditions are met. The function of the HSRP standby router is to monitor the operational status of the HSRP group and to quickly assume packet-forwarding responsibility if the active router fails.
The role of the active and standby routers is determined during the HSRP election process. By default, the router with the numerically highest IPv4 address is elected as the active router. However, it is always better to control how your network will operate under normal conditions rather than leaving it to chance.
By default, after a router becomes the active router, it will remain the active router even if another router comes online with a higher HSRP priority.
Note: With preemption disabled, the router that boots up first will become the active router if there are no other routers online during the election process.
The active and standby HSRP routers send hello packets to the HSRP group multicast address every 3 seconds by default. The standby router will become active if it does not receive a hello message from the active router after 10 seconds.
Configure HSRP on R1
R1(config)#
interface g0/1
standby version 2
standby 1 ip 192.168.1.254
standby 1 priority 150
standby 1 preempt
exit
exit
#show standby
#show standby brief
shutdown interface g0/1 and verify from R3 if it becomes Active router
activate interface g0/1 again and check R1 take the role of active router or not
Configure HSRP on R3
R3(config)#
interface g0/0
standby version 2
standby 1 ip 192.168.1.254
standby 1 preempt
exit
exit
#show standby
#show standby brief
change the priority from default value to 160
and check if R3 became Active router
ping from PC-B or PC-A
ping 209.165.200.226
tracert 209.165.200.226
ACC1(confg)#
vlan 10
name IT
vlan 20
name HR
interface f0/1
switchport mode access
switchport access vlan 10
interface f0/2
switchport mode access
switchport access vlan 20
ACC2(confg)#
vlan 10
name IT
vlan 20
name HR
interface f0/1
switchport mode access
switchport access vlan 10
interface f0/2
switchport mode access
switchport access vlan 20
ACC3(confg)#
vlan 10
name IT
vlan 20
name HR
interface f0/1
switchport mode access
switchport access vlan 10
interface f0/2
switchport mode access
switchport access vlan 20
ACC4(confg)#
vlan 10
name IT
vlan 20
name HR
interface f0/1
switchport mode access
switchport access vlan 10
interface f0/2
switchport mode access
switchport access vlan 20
MLS1(config)#
vlan 10
name IT
vlan 20
name HR
interface range g1/0/1-4 , g1/0/23-24
switchport mode trunk
ip routing
spanning-tree vlan 1,10,20 root primary
interface range g1/0/23-24
channel-group 1 mode on
interface Vlan10
ip address 192.168.10.100 255.255.255.0
!
interface Vlan20
ip address 192.168.20.100 255.255.255.0
MLS2(config)#
vlan 10
name IT
vlan 20
name HR
interface range g1/0/1-4 , g1/0/23-24
switchport mode trunk
ip routing
spanning-tree vlan 1,10,20 root secondary
interface range g1/0/23-24
channel-group 1 mode on
interface Vlan10
ip address 192.168.10.101 255.255.255.0
!
interface Vlan20
ip address 192.168.20.101 255.255.255.0