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
Router1(config-if)#
FastEthernet 0/1
ip address
Router1(config-if)#
172.22.1.3 255.255.255.0
standby 1 ip
Router1(config-if)#
172.22.1.1
standby 1 priority
Router1(config-if)#
120
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
Router2(config-if)#
FastEthernet 1/0
ip address
Router2(config-if)#
172.22.1.2 255.255.255.0
standby 1 ip
Router2(config-if)#
172.22.1.1
standby 1 priority
Router2(config-if)#
110
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.