The Cisco proprietary Hot Standby Router Protocol (HSRP) is a first-hop redundancy protocol (FHRP) intended to allow for transparent fail-over of the first-hop IP router, and is detailed in RFC 2281.
HSRP ensures high network availability by giving IP hosts on Ethernet, Fiber Distributed Data Interface (FDDI), Bridge-Group Virtual Interface (BVI), LAN Emulation (LANE), or Token Ring networks with a default gateway IP address with first-hop routing redundancy. In a group of routers, HSRP is used to pick an active router and a backup router. The active router is the router of choice for routing packets in a group of router interfaces; the standby router is the router that takes over when the current router fails or when predefined criteria are satisfied. HSRP active and standby routers use UDP port 1985 to transmit greeting messages to the multicast address 188.8.131.52.
The virtual router is essentially an IP and MAC address combination set as the default gateway by end devices. All packets and frames delivered to the virtual router address are processed by the current router. The virtual router is a software-only router that does not handle physical frames. The active router physically passes packets to the virtual router’s MAC address. The virtual router’s MAC address is 0000.0c07.acxx, where xx is the HSRP group member, and it is a well-known mac address. If the group is 20, for example, the virtual MAC address is 0000.0c07.ac14 (keep in mind that the number in the mac address is represented in HEX!!!).
The other HSRP routers cease receiving hello messages from the active router when the active router fails. As a result, the standby router will become the new active router, and a new standby router will be chosen if feasible. The end stations experience no service interruption since the new active router adopts the virtual router’s IP and MAC addresses. End-user stations continue to submit packets to the virtual router’s MAC address, which is delivered to the destination by the new active router.
There are two timings in HSRP:
Hello interval time: The time between consecutive HSRP hello messages sent by a specific router. The default timeout is 3 seconds.
Hold interval time: The period between receiving a hello message and concluding that the sender router is down. The default timeout is 10 seconds.
Three routers are linked to the local segment 192.168.0.0/24 in this example. These routers are members of HSRP group 1, and each physical interface has a unique IP address (192.168.0.11, 192.168.0.12, 192.168.0.13).
These routers will be represented by a single virtual router when HSRP is enabled; in this example, the MAC address is 0000.0c07.ac01 (0000.0c07.acxx is the HSRP well-known MAC address, and the 01 is the HSRP group number), and the virtual ip address is 192.168.0.1. Remember that the default gateway for the PC is 192.168.0.1, not the IP address of the routers’ physical interface.
ON THIS PAGE: Implementing and Explain High Availability with HSRP
You must do the following to activate HSRP:
- Define the interface’s physical IP address.
- Ciscozine 1 Define the HSRP virtual IP address
Ciscozine_1#sh run interface fastethernet 0/0 Building configuration... Current configuration : 123 bytes ! interface FastEthernet0/0 ip address 192.168.0.11 255.255.255.0 standby 1 ip 192.168.0.1 end Ciscozine_1#
Ciscozine_2#sh run interface fastethernet 0/0 Building configuration... Current configuration : 123 bytes ! interface FastEthernet0/0 ip address 192.168.0.12 255.255.255.0 standby 1 ip 192.168.0.1 end Ciscozine_2#
Ciscozine_3#sh run interface fastethernet 0/0 Building configuration... Current configuration : 123 bytes ! interface FastEthernet0/0 ip address 192.168.0.13 255.255.255.0 standby 1 ip 192.168.0.1 end Ciscozine_3#
Remember: The standby ip interface configuration command enables HSRP and establishes 192.168.0.1 as the IP address of the virtual router. The configurations of routers include this command so that the 3 routers share the same virtual IP address. The 1 establishes Hot Standby group 1. (If you do not specify a group number, the default is group 0.) The configuration for at least one of the routers in the Hot Standby group must specify the IP address of the virtual router; specifying the IP address of the virtual router is optional for other routers in the same Hot Standby group.
Optional settings are: preempt, priority, authentication, timers, …
Use the show standby command in privileged EXEC mode to provide information on the Hot Standby Router Protocol (HSRP).
show standby [type number [group-number]] [active | init | listen | standby] [brief]
Description of the syntax:
- type number: (Optional) Interface type and number for which output is displayed.
- group-number: (Optional) Group number on the interface for which output is displayed.
- active: (Optional) Displays HSRP groups in the active state.
- init: (Optional) Displays HSRP groups in the initial state.
- listen: (Optional) Displays HSRP groups in the listen or learn state.
- standby: (Optional) Displays HSRP groups in the standby or speak state.
- brief: (Optional) Summarizes each standby group as a single line of output.
In this istance, the output of the show standby command is:
Ciscozine_2#sh standby FastEthernet0/0 - Group 1 State is Standby 6 state changes, last state change 00:11:12 Virtual IP address is 192.168.0.1 Active virtual MAC address is 0000.0c07.ac01 Local virtual MAC address is 0000.0c07.ac01 (default) Hello time 3 sec, hold time 10 sec Next hello sent in 2.772 secs Preemption disabled Active router is 192.168.0.13, priority 100 (expires in 7.736 sec) Standby router is local Priority 100 (default 100) IP redundancy name is "hsrp-Fa0/0-1" (default) Ciscozine_2#
The active router (the router that forwards packets) will be the router with the highest IP address, and the stanby router will be the router with the second highest IP address if the routers’ priorities are equal.
Use the debug standby command to troubleshoot HSRP operations.
you can find another interestign article about HSRP and how to optimized on the next article here