Understanding HSRP Overview
HSRP (Hot Backup routing protocol): A proprietary technology of Cisco that ensures that the network edge device or access link fails, and that user communication recovers quickly and transparently, providing redundancy for the IP network. The Hot Backup routing protocol provides fault tolerance and enhanced routing for IP networks. By using a virtual IP address and virtual MAC address, two or more routers on a LAN segment can serve as a single virtual router.
Familiar with HSRP group members
HSRP Backup has an active router, a backup router, a virtual router, and other routers.
Active routers: The primary function is to forward packets to the virtual router. Another router in the group is selected as the backup router. The active router undertakes and maintains its active role by sending a hello message.
Backup routers: As long as the function is to monitor the running state of the HSRP group, and to the active router can not run, quickly assume the responsibility of forwarding packets. The backup router also transmits the Hello message informing the group of the roles and status changes for all routers in the backup router.
Virtual routers: The main function is to provide an end user with a router that can work continuously. The virtual router configuration has its own IP address and MAC address, but does not actually forward packets.
Other routers: These routers monitor the hello message, but do not respond. These routers forward any packets that pass through their packets, but do not forward the packets via the virtual router.
Understand the HSRP principle
Each router within the HSRP group has a specified priority to measure the priority of the router in the active router selection. The default priority is 100 (configurable range 0-255), and the highest-priority routers in the group become active routers, followed by the backup router. When the priority is the same, the router's LAN port IP address is compared, and the large address becomes the active router.
When a terminal user submits data to a virtual router, will be handled by the active router, when the active router fails, the backup router will assume the active router within a few seconds, when backup becomes an active router and backup router is vacant, other routers in the group will be promoted to the backup router. Select the backup router at the secondary priority level.
Configuration and application of HSRP
The HSRP configuration command syntax is as follows:
1, configure the HSRP members
Switch (cofnig-if) #standby group-number IP virtual-ip-address
Group-number: Represents the HSRP group to which this port belongs, and multiple HSRP groups can be created by specifying a unique group number in the backup command. Virtual-ip-address: Represents the IP address of the virtual HSRP router, which is the IP address of the network segment.
2. Configure HSRP Priority
Switch (cofnig-if) #standby Group-number priority Priority-value
Priority-value: Range is 0-255, default 100.
3, the allocation of HSRP preemptive right
Switch (cofnig-if) #standby Group-number preempt
The explanation of preemptive right: the HSRP backup router becomes an active router when the high priority active router in HSRP is maintained regularly. But when a previously high priority active router is repaired and added to the HSRP, if you do not configure preemptive power, it will not take back the location of the active router from the backup router, even if it is higher priority than the backup router, and if configured, it will snatch the active router from the lower priority router.
4, configure the HSRP port tracking
Switch (cofnig-if) #standby group-number track Interface-type mod/num interface-priority
Group-number: The group number of the port using the tracking function
Interface-type: Port type for trace port
Mod/num: Port number for trace ports
Interface-priority: When the port fails, the number of hot backup priority for the router will be lowered, and when the port becomes available, the router's priority will be added, and the default is 10.
Port Tracking Explanation: If port tracking is not set, when a router's port is not available, it still sends a hello message to the other router, which is available, but the data is not transmitted. When port tracking is configured for active routers, the priority of this active router decreases the corresponding value when the traced port is not available, and the corresponding value is raised when the variable is usable. This is a flexible way to provide a failover effect.
5, configure the Hello message timer
Switch (cofnig-if) #standby group-number times Hellotime holdtime
Hellotime:hello message time interval, default 3s, range 1-255.
The save time of the Holdtime:hello message, the default 10s, is generally set to three times times the Hello interval.
6, check the status of HSRP
Switch#show standby [Interface-type mod/num] [Group-number] Brief
Interface-type mod/num: Port type and sequence number to display
Group-number: The specific HSRP to display
Brief: Displays summary information, each backup group summarizes one row of output.
application Example of HSRP
Configure the company's two core three-tier switches to achieve a router backup + load balance.
The experimental topology is shown in the following illustration: