实验4 HSRP与上行链路跟踪<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
一、拓扑图
<?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" />
二、实验目的
(1)
实现企业总部局域网二层拓扑冗余备份(STP、核心层设备之间链路捆绑):SW1部署为整个局域网(所有Vlan)的根网桥,SW2部署为整个局域网的备份根网桥。
(2)
实现企业总部局域网三层全连通及主备份网关备份:SW1部署为Vlan8/10/12的主网关,Vlan11的备份网关。SW2部署为Vlan8/10/12的备份网关,Vlan11的主网关。
(3)
测试企业总部局域网HSRP主备网关倒换。
(4)
分析STP的选举过程。(根网桥、根端口、指定端口、阻塞端口)
(5)
测试企业总部局域网二层拓扑STP切换,并分析STP的端口状态切换过程。
(6)
分析PC1pingPC2的三层通信和二层通信过程。
三、实验内容
(1)
SW1
的基本信息配置
Switch>enable
Switch#configure terminal
Switch (config)#hostname SW1
SW1(config)#no ip domain-lookup
SW1(config)line console 0
SW1(config-line)logging synchronous
SW1(config-line)no login
SW1(config-line)privilege level 15
SW1(config-line)line vty 0 4
SW1(config-line)no login
SW1(config-line)privilege level 15
SW2
的基本信息配置
Switch>enable
Switch#configure terminal
Switch (config)#hostname SW2
SW2(config)#no ip domain-lookup
SW2(config)line console 0
SW2(config-line)logging synchronous
SW2(config-line)no login
SW2(config-line)privilege level 15
SW2(config-line)line vty 0 4
SW2(config-line)no login
SW2(config-line)privilege level 15
SW3
的基本信息配置
Switch>enable
Switch#configure terminal
Switch (config)#hostname SW3
SW3(config)#no ip domain-lookup
SW3(config)line console 0
SW3(config-line)logging synchronous
SW3(config-line)no login
SW3(config-line)privilege level 15
SW3(config-line)line vty 0 4
SW3(config-line)no login
SW3(config-line)privilege level 15
RT5
的基本信息配置
Switch>enable
Switch#configure terminal
Switch (config)#hostname RT5
RT5 (config)#no ip domain-lookup
RT5 (config)line console 0
RT5 (config-line)logging synchronous
RT5 (config-line)no login
RT5 (config-line)privilege level 15
RT5 (config-line)line vty 0 4
RT5 (config-line)no login
RT5 (config-line)privilege level 15
RT6
的基本信息配置
Switch>enable
Switch#configure terminal
Switch (config)#hostname RT6
RT6 (config)#no ip domain-lookup
RT6 (config)line console 0
RT6 (config-line)logging synchronous
RT6 (config-line)no login
RT6 (config-line)privilege level 15
RT6 (config-line)line vty 0 4
RT6 (config-line)no login
RT6 (config-line)privilege level 15
(2)创建Vlan
SW1
上创建Vlan
SW1#vlan datebase
SW1(vlan):vlan 8
SW1(vlan):vlan 10
SW1(vlan):vlan 11
SW1(vlan):vlan 12
SW1(vlan):exit
SW2
上创建Vlan
SW2#vlan datebase
SW2(vlan):vlan 8
SW2(vlan):vlan 10
SW2(vlan):vlan 11
SW2(vlan):vlan 12
SW2(vlan):exit
SW3
上创建Vlan
SW3#vlan datebase
SW3(vlan):vlan 8
SW3(vlan):vlan 10
SW3(vlan):vlan 11
SW3(vlan):vlan 12
SW3(vlan):exit
(3)SW3的2层接口配置
SW3(config)#interface fastEthernet 0/10
SW3(config-if)#switchport mode access
SW3(config-if)#switchport access vlan 10
SW3(config-if)#exit
SW3(config)#interface fastEthernet 0/11
SW3(config-if)#switchport mode access
SW3(config-if)#switchport access vlan 11
SW3(config-if)#exit
SW3(config)#interface fastEthernet 0/1
SW3(config-if)#switchport trunk encapsulation dot1q
SW3(config-if)#switchport mode trunk
SW3(config-if)#switchport trunk allowed vlan all
SW3(config-if)#exit
SW3(config)#interface fastEthernet 0/2
SW3(config-if)#switchport trunk encapsulation dot1q
SW3(config-if)#switchport mode trunk
SW3(config-if)#switchport trunk allowed vlan all
SW3(config-if)#exit
SW1
的二层接口配置
SW1(config)#interface fastEthernet 0/3
SW1(config-if)#sw itchport trunk encapsulation dot1q
SW1(config-if)#switchport mode trunk
SW1(config-if)#switchport trunk allowed vlan all
SW1(config-if)#exit
SW1(config)#interface range fastEthernet 0/1 -2
SW1(config-if-range)#switchport trunk encapsulation dot1q
SW1(config-if-range)#switchport mode trunk
*Mar 1 00:13:04.867: %DTP-5-TRUNKPORTON: Port Fa0/1-2 has become dot1q trunk
SW1(config-if-range)#switchport trunk allowed vlan all
SW1(config-if-range)#channel-group 2 mode on
Creating a port-channel interface Port-channel2
SW1(config-if-range)#
*Mar 1 00:13:20.035: %LINK-3-UPDOWN: Interface Port-channel2, changed state to up
*Mar 1 00:13:21.035: %LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel2, changed state to down
*Mar 1 00:13:21.155: %EC-5-BUNDLE: Interface Fa0/1 joined port-channel Po2
*Mar 1 00:13:21.347: %EC-5-BUNDLE: Interface Fa0/2 joined port-channel Po2
SW1(config-if-range)#
*Mar 1 00:13:23.179: %LINK-3-UPDOWN: Interface Port-channel2, changed state to up
SW1(config-if-range)#
*Mar 1 00:13:26.183: %LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel2, changed state to up
SW1(config-if-range)#
SW1#
*Mar 1 00:15:00.239: %SYS-5-CONFIG_I: Configured from console by console
SW2
的2层接口配置
SW2(config)#interface fastEthernet 0/3
SW2(config-if)#switchport trunk encapsulation dot1q
SW2(config-if)#switchport mode trunk
*Mar 1 00:16:00.931: %DTP-5-TRUNKPORTON: Port Fa0/3 has become dot1q trunk
SW2(config-if)#switchport trunk allowed vlan all
SW2(config-if)#exit
SW2(config)#interface range fastEthernet 0/1 -2
SW2(config-if-range)#switchport trunk encapsulation dot1q
SW2(config-if-range)#switchport mode trunk
*Mar 1 00:16:24.031: %DTP-5-TRUNKPORTON: Port Fa0/1-2 has become dot1q trunk
SW2(config-if-range)#switchport trunk allowed vlan all
SW2(config-if-range)#channel-group 2 mode on
Creating a port-channel interface Port-channel2
SW2(config-if-range)#
*Mar 1 00:16:50.731: %LINK-3-UPDOWN: Interface Port-channel2, changed state to up
*Mar 1 00:16:51.731: %LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel2, changed state to down
*Mar 1 00:16:51.835: %EC-5-BUNDLE: Interface Fa0/1 joined port-channel Po2
*Mar 1 00:16:52.087: %EC-5-BUNDLE: Interface Fa0/2 joined port-channel Po2
SW2(config-if-range)#
*Mar 1 00:16:53.883: %LINK-3-UPDOWN: Interface Port-channel2, changed state to up
SW2(config-if-range)#
*Mar 1 00:16:56.887: %LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel2, changed state to up
(4)SW1的三层接口配置
SW1(config)#interface fastEthernet 0/12
SW1(config-if)#no switchport
*Mar 1 00:19:33.475: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/12, changed state to up
SW1(config-if)#ip address 192.168.9.1 255.255.255.252
SW1(config-if)#no shutdown
SW2
的三层接口配置
SW2(config)#interface fastEthernet 0/12
SW2(config-if)#no switchport
*Mar 1 00:21:10.871: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/12, changed state to up
SW2(config-if)#ip address 192.168.9.5 255.255.255.252
SW2(config-if)#no shutdown
SW2(config-if)#exit
SW3
的网管IP
SW3(config)#interface vlan 8
SW3(config-if)#
*Mar 1 01:47:52.783: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan8, changed state to up
SW3(config-if)#ip address 192.168.8.132 255.255.255.128
SW3(config-if)#no shutdown
SW3(config-if)#exit
(5)SW1
的三层接口配置(SW2的这部分和SW1相同)
SW1(config)#interface vlan 8
*Mar 1 00:23:00.779: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan8, changed state to upd
SW1(config-if)#ip address 192.168.8.130 255.255.255.128
SW1(config-if)#no shutdown
SW1(config-if)#exit
SW1(config)#interface vlan 10
*Mar 1 00:23:17.291: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up
SW1(config-if)#ip address 192.168.10.2 255.255.255.0
SW1(config-if)#no shutdown
SW1(config-if)#exit
SW1(config)#interface vlan 11
SW1(config-if)#ip address 19
*Mar 1 00:23:35.967: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan11, changed state to up
SW1(config-if)#ip address 192.168.11.2 255.255.255.0
SW1(config-if)#no shutdown
SW1(config-if)#exit
SW1(config)#interface vlan 12
*Mar 1 00:24:00.323: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan12, changed state to up
SW1(config-if)#ip address 192.168.12.2 255.255.255.0
SW1(config-if)#no shutdown
SW1(config-if)#exit
配置路由RT5,RT6的IP (RT5,RT6相同
)
RT6(config)#interface ethernet 0/0
RT6(config-if)#ip address 192.168.9.6 255.255.255.252
RT6(config-if)#no shutdown
RT6(config-if)#exit
(6)SW1的HSRP配置
SW1(config)#interface vlan 8
SW1(config-if)#standby 8 ip 192.168.8.129
SW1(config-if)#standby 8 priority 200
SW1(config-if)#standby 8 preempt
SW1(config-if)#standby 8 track fastEthernet 0/12 60
SW1(config-if)#exit
SW1(config)#interface vlan 10
SW1(config-if)#standby 10 ip 192.168.10.1
SW1(config-if)#standby 10 priority 200
SW1(config-if)#standby 10 preempt
SW1(config-if)#standby 10 track fastEthernet 0/12 60
SW1(config-if)#
*Mar 1 01:10:27.787: %HSRP-6-STATECHANGE: Vlan10 Grp 10 state Standby -> Active
SW1(config-if)#exit
SW1(config)#interface vlan 11
SW1(config-if)#standby 11 ip 192.168.11.1
SW1(config-if)#standby 11 priority 150
SW1(config-if)#standby 11 preempt
SW1(config-if)#exit
SW1(config)#interface vlan 12
SW1(config-if)#standby 12 ip 192.168.12.1
SW1(config-if)#standby 12 priority 200
SW1(config-if)#standby 12 preempt
SW1(config-if)#standby 12 track fastEthernet 0/12 60
SW1(config-if)#exit
SW2
的HSRP配置
SW2(config)#interface vlan 8
*Mar 1 01:15:57.475: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan8, changed state to up
SW2(config-if)#standby 8 ip 192.168.8.129
SW2(config-if)#standby 8 priority 150
SW2(config-if)#standby preempt
SW2(config-if)#exit
SW2(config)#interface vlan 10
*Mar 1 01:17:48.919: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up
SW2(config-if)#standby 10 ip 192.168.10.1
SW2(config-if)#standby 10 priority 150
SW2(config-if)#standby 10 preempt
SW2(config-if)#exit
SW2(config)#interface vlan 11
SW2(config-if)#standby
*Mar 1 01:19:15.043: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan11, changed state to up
SW2(config-if)#standby 11 ip 192.168.11.1
SW2(config-if)#standby 11 priority 200
SW2(config-if)#standby 11 preempt
SW2(config-if)#standby 11 track fastEthernet 0/12 60
SW2(config-if)#exit
SW2(config)#interface vlan 12
*Mar 1 01:20:53.895: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan12, changed state to up
SW2(config-if)#standby 12 ip 192.168.12.1
SW2(config-if)#standby 12 priority 150
SW2(config-if)#standby 12 preempt
SW2(config-if)#exit
四
、测试结果
全网连通性测试
Ping
(通/不通)
|
PC1
|
PC2
|
SW1
|
SW2
|
SW3
|
RT5
|
RT6
|
192.168.9.1
|
√
|
×
|
√
|
×
|
√
|
×
|
×
|
192.168.9.2
|
×
|
×
|
×
|
×
|
×
|
×
|
×
|
192.168.9.5
|
×
|
√
|
×
|
√
|
U
|
×
|
×
|
192.168.9.6
|
×
|
×
|
×
|
×
|
U
|
×
|
×
|
192.168.8.132
|
√
|
√
|
√
|
√
|
√
|
×
|
×
|
五、遇到的问题及思考
初次做这个实验时,在对SW1,SW2进行配置时,对0/12端口,没有配置no switchprot,没有将它转换为三层端口,使得功能无法实现。
在配置完RT5的IP之后,忘记输入no shutdown命令开启端口,导致RT5这边的不通
思考了为什么许多设备之间无法Ping通,原因是少了路由配置。为了实现全网连通,对SW1,2和RT5,6分别进行了配置
给SW1添加了一条静态路由:
SW1(config)#ip route 192.168.9.4 255.255.255.252 192.168.10.3
给SW2添加了一条静态路由:
SW2(config)#ip route 192.168.9.0 255.255.255.252 192.168.10.2
给RT5添加了一条静态路由:
0.0.0.0 0.0.0.0 192.168.9.1
给RT6添加了一条静态路由:
0.0.0.0 0.0.0.0 192.168.9.5
六、实验心得
这次的实验相对之前的有些复杂,并更需要我们的思考,对数据流的分析过程让我更深入的了解了数据的封装和解封装的过程。中间遇到了很多小的问题,确实我所容易忽视的问题,提醒了我不再犯同样的这种错误,这个实验让我受益匪浅。
转载于:https://blog.51cto.com/leiroad/274624