Configuring Basic HSRP Functionality

Problem

You want a backup router to take over the MAC and IP addresses of a primary router if the primary fails.

Solution

Figure 22.1 represents a typical network design for use with HSRP on an Ethernet type LAN segment (including Fast Ethernet, Gigabit Ethernet, and 10 Gigabit Ethernet). There are two routers, called Router1 and Router2. They have IP addresses 172.22.1.3 and 172.22.1.2, respectively. When both routers are available, we want Router1 to handle all of the traffic, using the virtual IP address 172.22.1.1.

Configure the first router as follows:

Router1#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router1(config)#interface FastEthernet 0/1
Router1(config-if)#ip address 172.22.1.3 255.255.255.0
Router1(config-if)#standby 1 ip 172.22.1.1 
Router1(config-if)#standby 1 priority 120
Router1(config-if)#exit
Router1(config)#end
Router1#

The second router’s configuration is similar, except that the interface has a different real IP address and a lower HSRP priority level:

Router2#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router2(config)#interface FastEthernet 1/0
Router2(config-if)#ip address 172.22.1.2 255.255.255.0
Router2(config-if)#standby 1 ip 172.22.1.1 
Router2(config-if)#standby 1 priority 110
Router2(config-if)#exit
Router2(config)#end
Router2#

Discussion

In this example, we use the first address of the subnet, 172.22.1.1, as the virtual HSRP address, and consequently ...

Get Cisco IOS Cookbook, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.