《STP 生成树协议配置.docx》由会员分享,可在线阅读,更多相关《STP 生成树协议配置.docx(16页珍藏版)》请在三一办公上搜索。
1、实验八生成树配置实验1【实验名称】生成树协议STP【实验目的】理解生成树协议STP的配置及原理。【背景描述】某学校为了开展计算机教学和网络办公,建立了一个计算机教室和一个校办公区,这两 处的计算机网络通过两台交换机互连组成内部校园网,为了提高网络的可靠性,网络管理员 用2条链路将交换机互连,现要在交换机上做适当配置,使网络避免环路。本实验以2台S2126G交换机为例,2台交换机分别命名为SwitchA, SwitchB。PC1与 PC2在同一个网段,假设IP地址分别为192.168.0.137,192.168.0.136,网络掩码为 255.255.255.0 。【实现功能】使网络在有冗余链路
2、的情况下避免环路的产生,避免广播风暴等。【实验拓扑】SwitchASwitchB【实验设备】S2126G(2 台)【实验步骤】第一步:在每台交换机上开启生成树协议.例如对SwitchA做如下配置:SwitchA#configure terminal!进入全局配置模式SwitchA(config)#spanning-tree !开启生成树协议SwitchA(config)#end验证测试:验证生成树协议已经开启SwitchA#show spanning-tree !显示交换机生成树的状态StpVersion : MSTPSysStpStatus : EnabledBaseNumPorts : 2
3、4MaxAge : 20HelloTime : 2ForwardDelay : 15BridgeMaxAge : 20BridgeHelloTime : 2BridgeForwardDelay : 15MaxHops : 20TxHoldCount : 3PathCostMethod : LongBPDUGuard : DisabledBPDUFilter : Disabled# MST 0 vlans mapped : AllBridgeAddr : 00d0.f8ef.9e89Priority : 32768TimeSinceTopologyChange : 0d:0h:0m:8sTopo
4、logyChanges : 0DesignatedRoot : 800000D0F8EF9D09RootCost : 200000RootPort : Fa0/1CistRegionRoot : 800000D0F8EF9E89CistPathCost : 0SwitchA#show spanning-tree interface fastthernet 0/1! 显示交换机接口fastthernet 0/1 的状态PortAdminPortfast : DisabledPortOperPortfast : DisabledPortAdminLinkType : autoPortOperLin
5、kType : point-to-pointPortBPDUGuard: DisabledPortBPDUFilter: Disabled# MST 0 vlans mapped : AllPortState : forwarding!显示接口 fastthernet 0/1 处于转发(forwarding)状态PortPriority : 128PortDesignatedRoot : 800000D0F8EF9D09PortDesignatedCost : 0PortDesignatedBridge : 800000D0F8EF9D09PortDesignatedPort : 8001Po
6、rtForwardTransitions : 1PortAdminPathCost : 0PortOperPathCost : 200000PortRole : rootPort第二步:设置生成树模式SwitchA(config)#spanning-tree mode stp !设置生成树模式为 STP (802.1D)验证测试:验证生成树协模式为802.1DSwitchA#show spanning-treeStpVersion : STPSysStpStatus : EnabledBaseNumPorts : 24MaxAge : 20HelloTime : 2ForwardDelay :
7、 15BridgeMaxAge : 20BridgeHelloTime : 2BridgeForwardDelay : 15MaxHops : 20TxHoldCount : 3PathCostMethod : LongBPDUGuard : DisabledBPDUFilter : DisabledBridgeAddr : 00d0.f8ef.9e89Priority : 32768TimeSinceTopologyChange : 0d:0h:7m:0sTopologyChanges : 0DesignatedRoot : 800000D0F8EF9D09RootCost : 200000
8、RootPort : Fa0/1第三步:设置交换机的优先级SwitchA(config)#spanning-tree priority 4096!设置交换机 SwitchA 的优先级为 4096,数值最小的交换机为根交换机(也称根桥),交换机SwitchB的优先级采用默认优先 级(32768),因此SwitchA将成为根交换机。验证测试:验证交换机SwitchA的优先级SwitchA#show spanning-treeStpVersion : STPSysStpStatus : EnabledBaseNumPorts : 24MaxAge : 20HelloTime : 2ForwardDe
9、lay : 15BridgeMaxAge : 20BridgeHelloTime : 2BridgeForwardDelay : 15MaxHops : 20TxHoldCount : 3PathCostMethod : LongBPDUGuard : DisabledBPDUFilter : DisabledBridgeAddr : 00d0.f8ef.9e89Priority : 4096TimeSinceTopologyChange : 0d:0h:0m:0sTopologyChanges : 26DesignatedRoot : 100000D0F8EF9E89RootCost : 0
10、RootPort : 0第四步:综合验证测试1 .验证交换机SwitchB的端口 F0/ 1和F0/ 2的状态SwitchB#show spanning-tree interface fastEthernet 0/1 !显示 SwitchB 的端口 fastthernet 0/1 的状态PortAdminPortfast : DisabledPortOperPortfast : DisabledPortAdminLinkType : autoPortOperLinkType : point-to-pointPortBPDUGuard: DisabledPortBPDUFilter: Disab
11、ledPortState : forwarding ! SwitchB 的端口 fastthernet 0/ 1处于转发(forwarding) 状态PortPriority : 128PortDesignatedRoot : 200000D0F8EF9E89PortDesignatedCost : 0PortDesignatedBridge : 200000D0F8EF9E89PortDesignatedPort : 8002PortForwardTransitions : 22PortAdminPathCost : 0PortOperPathCost : 200000PortRole :
12、rootPortSwitchB#show spanning-tree interface fastEthernet 0/2 !显示 SwitchB 的端口 fastthernet 0/2 的状态PortAdminPortfast : DisabledPortOperPortfast : DisabledPortAdminLinkType : autoPortOperLinkType : point-to-pointPortBPDUGuard: DisabledPortBPDUFilter: DisabledPortState : discarding ! SwitchB 的端口 fastthe
13、rnet 0/2 处于阻塞(discarding) 状态PortPriority : 128PortDesignatedRoot : 200000D0F8EF9E89PortDesignatedCost : 200000PortDesignatedBridge : 800000D0F8EF9D09PortDesignatedPort : 8002PortForwardTransitions : 39PortAdminPathCost : 0PortOperPathCost : 200000PortRole : alternatePort2.验证网络拓扑发生变化时,ping的丢包情况C:ping
14、 192.168.0.136 - t !从主机PC1 ping PC2 (用连续 ping),然后拔掉 SwitchA 与SwitchB的端口 F0/1之间的连线,观察丢包情况。显示结果如下:Reply from 192.168.0.136:bytes=32time10msTTL=128Reply from 192.168.0.136:bytes=32time10msTTL=128Reply from 192.168.0.136:bytes=32time10msTTL=128Reply from 192.168.0.136:bytes=32time10msTTL=128Request t im
15、edout.Request t imedout.Request t imedout.Request t imedout.Request t imedout.Request t imedout.Request t imedout.Request t imedout.Request t imedout.Request t imedout.Request t imedout.Request t imedout.Request t imedout.Request t imedout.Request t imedout.Request t imedout.Request t imedout.Reques
16、t t imedout.Request t imedout.Request t imedout.Request t imedout.Request t imedout.Request t imedout.Request t imedout.Request t imedout.Request t imedout.Request t imedout.Request t imedout.Request t imedout.Request t imedout.Reply from 192.168.0.136:bytes=32time10msTTL=128Reply from 192.168.0.136
17、:bytes=32timeping 192.168.0.136 - t !从主机PC1 ping PC2 (用连续 ping),然后拔掉 SwitchA 与SwitchB的端口 F0/1之间的连线,观察丢包情况。显示结果如下:ReplyReplyReplyReplyReplyfrom 192.168.0.136:from 192.168.0.136:from 192.168.0.136:from 192.168.0.136:from 192.168.0.136:Request timed out.ReplyReplyReplyReplyReplyfrom 192.168.0.136:from
18、192.168.0.136:from 192.168.0.136:from 192.168.0.136:from 192.168.0.136:bytes=32 bytes=32 bytes=32 bytes=32 bytes=32bytes=32 bytes=32 bytes=32 bytes=32 bytes=32time10ms time10ms time10ms time10ms time10mstime10ms time10ms time10ms time10ms time10msTTL=128TTL=128TTL=128TTL=128TTL=128TTL=128TTL=128TTL=
19、128TTL=128TTL=128以上结果显示丢包数为1个。【注意事项】锐捷交换机缺省是关闭spanning-tree的,因此,如果网络在物理上存在环路,则必须 手工开启 spanning-tree。【参考配置】SwitchA#show run !交换机SwitchA的全部配置 Building configuration.Current configuration : 123 bytes !version 1.0!hostname SwitchAspanning-tree mode rstpspanning-treespanning-tree mst 0 priority 8192 endSwitchB#show run !交换机SwitchB的全部配置 Building configuration.Current configuration : 86 bytes !version 1.0!hostname SwitchBspanning-tree mode rstpspanning-treeend乌鲁木齐装修rm3LKxtG6SF7