三种路由器冗余协议的配置示例
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
三种路由器冗余协议的配置示例
2009-02-22 16:26:08| 分类:Cisco|字号订阅
拓扑图
实验用到的是4台3640路由器,我用的镜像是unzip-c3640-ik9o3s-mz.124-10.bin 其中HSRP和VRRP用到SW1、SW2和SW3,而GLBP则用到全部4台路由器。
一、HSRP
1. 配置HSRP
SW1(config)#interface vlan 50
SW1(config-if)#ip address 192.168.1.10 255.255.255.0
SW1(config-if)#standby 1 priority 200
SW1(config-if)#standby 1 preempt
SW1(config-if)#standby 1 ip 192.168.1.1
SW1(config-if)#standby 1 authentication MyKey
SW1(config-if)#standby 2 priority 100
SW1(config-if)#standby 2 ip 192.168.1.2
SW1(config-if)#standby 2 authentication MyKey
SW1(config-if)#^Z
SW2(config)#interface vlan 50
SW2(config-if)#ip address 192.168.1.11 255.255.255.0
SW2(config-if)#standby 1 priority 100
SW2(config-if)#standby 1 ip 192.168.1.1
SW2(config-if)#standby 1 authentication MyKey
SW2(config-if)#standby 2 priority 200
SW2(config-if)#standby 2 preempt
SW2(config-if)#standby 2 ip 192.168.1.2
SW2(config-if)#standby 2 authentication MyKey
SW2(config-if)#^Z
我们在这里一共配置了两个standby group,其中SW1充当group 1的active router,并配置了抢占,同时,它还充当了group 2的standby router。同理,SW2是group 2的active router,同时为group 1的standby router。
这时侯我们查看HSRP信息:
SW1#show standby vlan 50 brief
P indicates configured to preempt.
|
Interface Grp Prio P State Active Standby Virtual IP
Vl50 1 200 P Init unknown unknown 192.168.1.1 Vl50 2 100 Init unknown unknown 192.168.1.2
显示HSRP的状态为Init,而Standby为Unknown,这是由于我们还没有配置VLAN 50及将端口关联到VLAN 50
2. 在SW1和SW2上配置VLAN
SW1(vlan)#vlan 50
VLAN 50 added:
Name: VLAN0050
SW1(vlan)#exit
APPLY completed.
Exiting....
SW1#config t
Enter configuration commands, one per line. End with CNTL/Z.
SW1(config)#int f0/1
SW1(config-if)#switchport
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 50
SW1(config-if)#
SW2#vlan database
SW2(vlan)#vlan 50
VLAN 50 added:
Name: VLAN0050
SW2(vlan)#exit
APPLY completed.
Exiting....
SW2#config t
Enter configuration commands, one per line. End with CNTL/Z.
SW2(config)#int f0/1
SW2(config-if)#switch
SW2(config-if)#switchport mode access
SW2(config-if)#switchport access vlan 50
配置完成后我们可以看到SW1和SW2经历如下过程:
SW1(config-if)#
*Mar 1 00:17:08.155: %HSRP-5-STATECHANGE: Vlan50 Grp 1 state Speak -> Standby *Mar 1 00:17:08.155: %HSRP-5-STATECHANGE: Vlan50 Grp 2 state Speak -> Standby *Mar 1 00:17:08.655: %HSRP-5-STATECHANGE: Vlan50 Grp 1 state Standby -> Active *Mar 1 00:17:08.659: %HSRP-5-STATECHANGE: Vlan50 Grp 2 state Standby -> Active *Mar 1 00:17:17.783: %HSRP-5-STATECHANGE: Vlan50 Grp 2 state Active -> Speak
可以看到,SW1先从Speak状态转为Standby,然后尝试称为Active,在Group 2中,由于SW2的优先级比SW1高,所以SW1又转换为Speak
输入debug standby events
SW1#debug standby events
HSRP Events debugging is on
SW1#
*Mar 1 00:05:24.131: HSRP: Vl50 Grp 1 Active: i/Resign rcvd (100/192.168.1.11)
*Mar 1 00:05:24.135: HSRP: Vl50 Grp 2 Active: j/Coup rcvd from higher pri router (200/192.168.1.11)
*Mar 1 00:05:24.139: HSRP: Vl50 Grp 2 Active router is 192.168.1.11, was local
*Mar 1 00:05:24.139: HSRP: Vl50 Grp 2 Active -> Speak
*Mar 1 00:05:24.139: %HSRP-5-STATECHANGE: Vlan50 Grp 2 state Active -> Speak SW1#
*Mar 1 00:05:24.139: HSRP: Vl50 Grp 2 Redundancy "hsrp-Vl50-2" state Active -> Speak
SW1#
*Mar 1 00:05:27.131: HSRP: Vl50 Grp 1 Redundancy group hsrp-Vl50-1 state Active -> Active
SW1#
*Mar 1 00:05:30.131: HSRP: Vl50 Grp 1 Redundancy group hsrp-Vl50-1 state Active