电脑技术学习

双机热备经典案例之Cisco HSRP的配置

dn001

22.3.;配置HSRP对接口问题追踪的支持

提问 当主用路由器的上联端口出现问题后主动切换到备用路由器

回答

Router1#configure terminal
Enter configuration commands, one per line.;End with CNTL/Z.
Router1(config)#interface FastEthernet0/1
Router1(config-if)#standby 1 ip 172.22.1.1
Router1(config-if)#standby 1 priority 120
Router1(config-if)#standby 1 preempt
Router1(config-if)#standby 1 track Serial0/0 20
Router1(config-if)#exit
Router1(config)#end
Router1#

从12.2(15)T后引入更多可追踪实例

Router1#configure terminal
Enter configuration commands, one per line.;End with CNTL/Z.
Router1(config)#track 11 interface Serial1/1 ip routing
Router1(config-track)#exit
Router1(config)#interface FastEthernet0/0
Router1(config-if)#standby 1 ip 172.22.1.1
Router1(config-if)#standby 1 priority 120
Router1(config-if)#standby 1 preempt
Router1(config-if)#standby 1 track 11 decrement 50
Router1(config-if)#end
Router1#

注释 Router1#show track

Track 11
Interface Serial1/1 ip routing
IP routing is Down (hw admin-down, ip disabled)
1 change, last change 00:12:48
Tracked by:
HSRP FastEthernet0/0 1
22.4.;HSRP负载均衡

提问 在两台或者多台HSRP路由器上实现流量的负载均衡

回答

Router1#configure terminal
Enter configuration commands, one per line.;End with CNTL/Z.
Router1(config)#interface FastEthernet0/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)#standby 1 preempt
Router1(config-if)#standby 2 ip 172.22.1.2
Router1(config-if)#standby 2 priority 110
Router1(config-if)#standby 2 preempt
Router1(config-if)#exit
Router1(config)#end
Router1#
Router2#configure terminal
Enter configuration commands, one per line.;End with CNTL/Z.
Router2(config)#interface FastEthernet1/0
Router2(config-if)#ip address 172.22.1.4 255.255.255.0
Router2(config-if)#standby 1 ip 172.22.1.1
Router2(config-if)#standby 1 priority 110
Router2(config-if)#standby 1 preempt
Router2(config-if)#standby 2 ip 172.22.1.2
Router2(config-if)#standby 2 priority 120
Router2(config-if)#standby 2 preempt
Router2(config-if)#exit
Router2(config)#end
Router2#

注释 由于出现两个网关,所以需要在终端设备上分开配置各自的缺省网关。