一、实验目的
①理解生成树协议STP和RSTP的原理
②掌握STP和RSTP的配置方法以及在冗余链路设计中应用
二、实验思想
根据实验原理图及拓扑图,选择两台主机作为测试机器,两台为配置机器,先在两台配置机上设置跨交换机相同VLAN间的通信,而测试机用于测试两机能否PING通。若能,则进行下一步实验,即配置生成树。(交换机1与交换机2之间有L1、L2两冗余链路,分别连接在端口f0/8和f0/10上,其中设置f0/8为根端口;两测试机器分别连接在交换机1、交换机2的f0/20上)
三、拓扑图
四、实验内容
1.实现跨交换机相同VLAN间通信:
(1).在两测试主机上都拔掉配置线(上)或者禁用本地连接1,再分别设置本地连接2的IP地址172.16.12.x、子网掩码255.255.255.0、默认网关172.16.12.xxx
(2).在交换机1和交换机2上进行如下设置:
(配置主机拔掉测试线【下】或者禁用本地连接2)
配置命令:
Switch#show vlan //查看vlan信息
Switch#configure terminal
Switch(config)#no vlan ID //删除非默认vlan
Switch(config-vlan)#end
Switch#show vlan
Switch#configure terminal
Switch(config)#vlan 10 //创建vlan10
Switch(config-vlan)#end
Switch#show vlan
Switch#configure terminal
Switch(config)#interface f0/8 //指定端口f0/8
Switch(config-if)#switchport access vlan 10
//把这个接口分配给VLAN10
Switch(config-if)#switchport mode trunk //定义该端口为trunk端口
Switch(config-if)#end
Switch#configuer terminal
Switch(config)#interface f0/10
Switch(config-if)#switchport access vlan 10
Switch(config-if)#switchport mode trunk
Switch(config-if)#end
Switch#configure terminal
Switch(config)#interface f0/20
Switch(config-if)#switchport access vlan 10
Switch(config-if)#end
Switch#copy running-config startup-config //保存配置
(3).在两测试机上互相PING对方IP地址
2. 配置生成树
(1).在交换机1上进行如下设置:
Switch1#show spanning-tree
Swiitch1#show spanning-tree interface fastethernet 0/2
Switch1#configure terminal
Switch1(config)#spanning-tree
Switch1(config)#end
Switch1#show spanning-tree
Switch1#show spanning-tree interface fastethernet 0/2
Switch1#configure terminal
Switch1(config)#spanning-tree mod stp //指定生成树模式为STP模式
Switch1(config)#end
Switch1#show spanning-tree
Switch1#configure terminal
Switch1(config)#spanning-tree priority 4096 //将交换机1的优先级设置为4096,则交换机1为根交换机
Switch1#configure terminal
Switch1(config)#interface f0/2
Switch1(config)#spanning-tree port- priority 64 //将端口2的优先级设为64,
即根端口
Switch1(config)#end
Switc1h#show spanning-tree
Switch1#copy running-config startup-config
(2).在交换机2上进行如下设置:
Switch2#configure terminal
Switch2(config)#spanning-tree //开启生成树协议
Switch2(config)#spanning-tree mode stp //制定生成树模式为STP模式
Switch2(config)#end
Switch2#copy running-config startup-config
Switch2#show spanning-tree
Switch2#show spanning-tree interface fastethernet 0/2
Switch2#show spanning-tree interface fastethernet 0/11
比较两次的显示结果会发现,前面的STP状态是Disable,后面的STP状态是Enable且STP版本是STP,即说明开启了生成树协议。
(3).将f0/10端口的线分别连接在交换机1与交换机2上,数秒后在两测试主机上运行ping172.16.12.x ,能PING通。稍后再断开f0/8上主链路连线,观察现象,会发现显示请求超时情况,一段短暂时间过后又显示PING通。
五、实验总结
①本实验的收获:
通过本次实验,我掌握了VLAN的基本配置方法并了解了实现跨交换机相同VLAN间的通信。在此基础上,通过理解生成树实验协议STP和RSTP的原理和掌握STP及RSTP的配置方法、在冗余链路设计中的应用等,从而完成了本次实验。
②实验过程中遇到的问题及解决办法:
问题:由于实验室实验设备不完善,我们用于实验的电脑出现了物理连接不通的问题,或者由于实验之前线路连接错误导致实验失败,以及在实验过程中粗心输入了错误的终端配置命令或者漏输
解决办法:实验前首先检查用作实验机器的物理连接,从根源排除错误,可以采用更换连接线或者更换实验电脑的方法。若配置命令出错,逐行检查,然后改正命令。若是出现了不正常的错误,可以清除之前的配置,重新进行实验。
因篇幅问题不能全部显示,请点此查看更多更全内容