HSRP实验过程及报告
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
目录
HSRP实验过程及报告 (2)
实验环境: (2)
实验拓扑: (2)
实验目的: (2)
实验过程: (3)
1 配置交换机 (3)
2 测试HSRP (5)
3测试HSRP跟踪 (8)
实验总结: (10)
HSRP实验过程及报告
实验环境:DynamipsGUI模拟器模拟出4台cisco3640三层交换机。
两台开启HSRP协议,设备之间使用Ethernetchannel绑定的两条线路互联。
其余两台交换机分别连接到这两台交换机。
实验拓扑:实验拓扑如图1
实验目的:熟悉HSRP协议,验证HSRP网关冗余特性,测试HSRP抢占过程及HSRP接口跟踪。
实验过程:
1 配置交换机
在交换机SW1配置F0/0.F0/1接口加入channel-group 1 并将port-channel 1 配置为trunk模式。
SW1(config)#int range f0/0 - 1
SW1(config-if-range)#channel-group 1 mode on
Creating a port-channel interface Port-channel1
SW1(config-if-range)#
*Mar 1 01:23:58.639: %EC-5-BUNDLE: Interface Fa0/0 joined port-channel Po1 *Mar 1 01:23:58.935: %EC-5-BUNDLE: Interface Fa0/1 joined port-channel Po1 SW1(config-if-range)#
*Mar 1 01:24:01.415: %LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel1, changed state to up
SW1(config-if-range)#exit
SW1(config)#int port-channel 1
SW1(config-if)#switchport mode trunk
SW1(config-if)#end
SW1#sh etherchannel su
Flags: D - down P - in port-channel
I - stand-alone s - suspended
R - Layer3 S - Layer2
U - in use
Group Port-channel Ports
-----+------------+-----------------------------------------------------------
1 Po1(SU) Fa0/0(P) Fa0/1(P)
在交换机SW2上同样的配置。
.
SW2(config)#int range f0/0 - 1
SW2(config-if-range)#chan
SW2(config-if-range)#channel-group 1 mode on
Creating a port-channel interface Port-channel1
SW2(config-if-range)#
*Mar 1 01:24:38.119: %EC-5-BUNDLE: Interface Fa0/0 joined port-channel Po1 *Mar 1 01:24:38.391: %EC-5-BUNDLE: Interface Fa0/1 joined port-channel Po1 SW2(config-if-range)#int port
*Mar 1 01:24:40.971: %LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel1, changed state to up
SW2(config-if-range)#exit
SW2(config)#int port-channel 1
SW2(config-if)#switchport mode trunk
SW2#sh
SW2#sh etherchannel summary
Flags: D - down P - in port-channel
I - stand-alone s - suspended
R - Layer3 S - Layer2
U - in use
Group Port-channel Ports
-----+------------+-----------------------------------------------------------
1 Po1(SU) Fa0/0(P) Fa0/1(P)
配置HSRP
SW1(config)#int vl 1
SW1(config-if)#ip add 192.168.1.11 255.255.255.0
SW1(config-if)#standby 10 ip 192.168.1.100
SW1(config-if)#standby 10 priority 110
SW1(config-if)#standby 10 preempt
SW1(config-if)#
*Mar 1 03:57:44.467: %HSRP-5-STA TECHANGE: Vlan1 Grp 10 state Speak -> Standby
*Mar 1 03:57:44.967: %HSRP-5-STATECHANGE: Vlan1 Grp 10 state Standby -> Active
查看HSRP状态
Vlan1 - Group 10
State is Active
2 state changes, last state change 00:00:59
Virtual IP address is 192.168.1.100
Active virtual MAC address is 0000.0c07.ac0a
Local virtual MAC address is 0000.0c07.ac0a (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 0.936 secs
Preemption enabled
Active router is local
Standby router is unknown
Priority 110 (configured 110)
IP redundancy name is "hsrp-Vl1-10" (default)
先配置HSRP的为活跃状态,抢占模式,优先级为110(手动配置)。
SW2(config-if)#ip add 192.168.1.22 255.255.255.0
SW2(config-if)#standby 10 ip 192.168.1.100
SW2(config-if)#standby 10 preempt
SW2(config-if)#
*Mar 1 04:01:09.207: %HSRP-5-STA TECHANGE: Vlan1 Grp 10 state Speak -> Standby
查看SW2的HSRP状态
Vlan1 - Group 10
State is Standby
1 state change, last state change 00:00:50
Virtual IP address is 192.168.1.100
Active virtual MAC address is 0000.0c07.ac0a
Local virtual MAC address is 0000.0c07.ac0a (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 0.908 secs
Preemption enabled
Active router is 192.168.1.11, priority 110 (expires in 8.792 sec)
Standby router is local
Priority 100 (default 100)
IP redundancy name is "hsrp-Vl1-10" (default)
该设备为standby状态,配置了抢占模式,优先级为默认的100。
2 测试HSRP
使用SW3尝试不停ping虚拟IP 192.168.1.100,期间切换主备交换机,产看切换情况。
SW1(config)#int vl 1
SW1(config-if)#shut
SW1(config-if)#
*Mar 1 04:21:17.062: %HSRP-5-STA TECHANGE: Vlan1 Grp 10 state Active -> Init
SW1(config-if)#
*Mar 1 04:21:19.066: %LINK-5-CHANGED: Interface Vlan1, changed state to administratively down
*Mar 1 04:21:20.066: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to down
SW1(config-if)#
关闭了SW1上的VLAN 1,查看交换机SW2上的HSRP情况。
SW2#sh stan
*Mar 1 04:21:06.262: %HSRP-5-STATECHANGE: Vlan1 Grp 10 state Standby -> Active
SW2#sh stan
Vlan1 - Group 10
State is Active
8 state changes, last state change 00:00:07
Virtual IP address is 192.168.1.100
Active virtual MAC address is 0000.0c07.ac0a
Local virtual MAC address is 0000.0c07.ac0a (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 1.828 secs
Preemption enabled
Active router is local
Standby router is unknown
Priority 100 (default 100)
IP redundancy name is "hsrp-Vl1-10" (default)
可以看到SW2的HSRP状态为Active,观察交换机SW3的ping包情况
SW3#ping 192.168.1.100 repeat 1000
Type escape sequence to abort.
Sending 1000, 100-byte ICMP Echos to 192.168.1.100, timeout is 2 seconds:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
中间黄色部分为中断过程,是由于HSRP自动切换了活跃设备所引起的,由于切换了活跃交换机,所以导致有一个包是被丢弃的。
当SW1失去响应时,HSRP的hello包检测到交换机SW1没有响应。
SW2将切为active状态,保证了网络的可靠性。
当SW1恢复运行状态,由于SW1配置了抢占且SW1的优先级高于SW2的优先级,所以SW1会成为主,而SW2将成为备。
SW1(config-if)#no shut
SW1(config-if)#
*Mar 1 04:27:56.090: %LINK-3-UPDOWN: Interface Vlan1, changed state to up SW1(config-if)#
*Mar 1 04:27:56.170: %HSRP-5-STA TECHANGE: Vlan1 Grp 10 state Listen -> Active
*Mar 1 04:27:57.090: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to up
SW1(config-if)#end
SW1#sh stan vl 1
Vlan1 - Group 10
State is Active
8 state changes, last state change 00:01:10
Virtual IP address is 192.168.1.100
Active virtual MAC address is 0000.0c07.ac0a
Local virtual MAC address is 0000.0c07.ac0a (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 1.548 secs
Preemption enabled
Active router is local
Standby router is 192.168.1.22, priority 100 (expires in 9.688 sec)
Priority 110 (configured 110)
IP redundancy name is "hsrp-Vl1-10" (default)
交换机SW1状态切为Active。
SW2#sh stan
Vlan1 - Group 10
State is Standby
10 state changes, last state change 00:00:24
Virtual IP address is 192.168.1.100
Active virtual MAC address is 0000.0c07.ac0a
Local virtual MAC address is 0000.0c07.ac0a (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 2.808 secs
Preemption enabled
Active router is 192.168.1.11, priority 110 (expires in 8.728 sec)
Standby router is local
Priority 100 (default 100)
IP redundancy name is "hsrp-Vl1-10" (default)
如果不配置抢占模式,当SW1恢复状态是不会自动切为Active状态的。
SW1(config)#int vl 1
SW1(config-if)#no standby 10 pre
SW1(config-if)#shut
SW1(config-if)#
*Mar 1 04:31:50.102: %HSRP-5-STA TECHANGE: Vlan1 Grp 10 state Active -> Init
*Mar 1 04:31:52.110: %LINK-5-CHANGED: Interface Vlan1, changed state to administratively down
*Mar 1 04:31:53.110: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to down
SW1(config-if)#no shut
SW1(config-if)#
*Mar 1 04:31:59.890: %LINK-3-UPDOWN: Interface Vlan1, changed state to up *Mar 1 04:32:00.890: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to up
SW1(config-if)#end
SW1#sh stan vl 1
Vlan1 - Group 10
State is Standby
10 state changes, last state change 00:00:20
Virtual IP address is 192.168.1.100
Active virtual MAC address is 0000.0c07.ac0a
Local virtual MAC address is 0000.0c07.ac0a (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 0.152 secs
Preemption disabled
Active router is 192.168.1.22, priority 100 (expires in 8.304 sec)
Standby router is local
Priority 110 (configured 110)
IP redundancy name is "hsrp-Vl1-10" (default)
在没有配置抢占模式时,当SW1恢复正常运行状态后,是无法将自己切为Active 状态的。
SW2会继续保持Active状态。
SW2#sh stan
Vlan1 - Group 10
State is Active
11 state changes, last state change 00:02:25
Virtual IP address is 192.168.1.100
Active virtual MAC address is 0000.0c07.ac0a
Local virtual MAC address is 0000.0c07.ac0a (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 1.884 secs
Preemption enabled
Active router is local
Standby router is 192.168.1.11, priority 110 (expires in 7.736 sec)
Priority 100 (default 100)
IP redundancy name is "hsrp-Vl1-10" (default)
可以看到即使SW1的优先级110比SW2的优先级100高,但由于没有配置抢占模式,SW1依然无法切为Active状态。
3测试HSRP跟踪
配置HSRP跟踪
SW1(config)#int vl 1
SW1(config-if)#standby 10 track fastEthernet 0/3 30
对交换机SW1的F0/3接口连接的线路进行跟踪,F0/3连接着交换机SW4的F0/3
接口。
如果当这条线路出现问题时,会自动将该交换机的优先级降低30。
由于备机的优先级为默认(100)同时配置了抢占模式,所以该交换机会切为standby 状态。
SW1(config)#int f0/3
SW1(config-if)#shut
SW1(config-if)#
*Mar 1 04:56:32.046: %TRACKING-5-STA TE: 1 interface Fa0/3 line-protocol Up->Down
*Mar 1 04:56:32.546: %DTP-5-NONTRUNKPORTON: Port Fa0/3 has become non-trunk
SW1(config-if)#
*Mar 1 04:56:33.258: %HSRP-5-STA TECHANGE: Vlan1 Grp 10 state Active -> Speak
*Mar 1 04:56:33.914: %LINK-5-CHANGED: Interface FastEthernet0/3, changed state to administratively down
SW1(config-if)#
*Mar 1 04:56:34.914: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down
SW1(config-if)#
查看HSRP状态
SW1#sh standby vl 1
Vlan1 - Group 10
State is Standby
18 state changes, last state change 00:01:58
Virtual IP address is 192.168.1.100
Active virtual MAC address is 0000.0c07.ac0a
Local virtual MAC address is 0000.0c07.ac0a (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 1.856 secs
Preemption enabled
Active router is 192.168.1.22, priority 100 (expires in 7.856 sec)
Standby router is local
Priority 80 (configured 110)
Track interface FastEthernet0/3 state Down decrement 30
IP redundancy name is "hsrp-Vl1-10" (default)
降低后的优先级为80,低于交换机SW2的优先级100,所以交换机SW2为standby 状态。
Vlan1 - Group 10
State is Active
20 state changes, last state change 00:04:45
Virtual IP address is 192.168.1.100
Active virtual MAC address is 0000.0c07.ac0a
Local virtual MAC address is 0000.0c07.ac0a (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 2.284 secs
Preemption enabled
Active router is local
Standby router is 192.168.1.11, priority 80 (expires in 7.320 sec)
Priority 100 (default 100)
IP redundancy name is "hsrp-Vl1-10" (default)
接口跟踪的目的是防止数据包被丢弃,由于启用了HSRP,ICMP重定向被禁用。
交换机SW1和虚拟路由器都不会发送ICMP重定向,同时交换机SW1的F0/3接口运行不正常,但仍会从接口F0/2向SW3发送hello消息,指出交换机SW1仍为活跃路由器,这种情况下,发送个虚拟路由器去往SW4的数据包将被丢弃。
接口跟踪就是防止了这种情况的发生。
实验总结:通过这系列实验,熟悉了HSRP的协议,加深了理解。
测试了HSRP
的接口跟踪过程。
完成了对HSRP的学习。
有一点遗憾,是由于使用的是模拟器,有部分功能无法测试。
比如,再测试HSRP跟踪的时候,应该测试关闭SW4与SW1相连的接口,导致SW1的F0/3接口line protocol is down。
但在模拟器中,即使关闭了SW4的F0/3接口,SW1的F0/3接口仍然为up状态。