生成树协议的配置【实训背景】学校为了开展计算机教学和网络办公,建立了一个计算机教室和一个校办公区,这两处的计算机网络通过两台交换机互连组成内部校园网;为了提高网络的可靠性,作为网络管理员的你要用2条链路将交换机互连,现要求在交换机上做适当配置,使网络避免环路。
【实训目的】掌握生成树协议的配置方法,理解生成树协议的作用和特点【技术原理】生成树协议( spanning-tree) ,作用是在交换网络中提供冗余备份链路,并且解决交换网络中的环路问题。
生成树协议是利用SPA算法(生成树算法),在存在交换环路的网络中生成一个没有环路的树形网络。
运用该算法将交换网络冗余的备份链路逻辑上断开,当主要链路出现故障时,能够自动的切换到备份链路,保证数据的正常转发。
生成树协议的特点是收敛时间长。
当主要链路出现故障以后,到切换到备份链路需要 50秒的时间。
【实训内容】1、根据拓扑将主机和交换机进行连接(未形成环路)2、测试主机之间可以相互ping通3、配置生成树协议4、测试(形成环路)5、测试(断开主要链路)【实现功能】使网络在有冗余链路的情况下避免环路的产生,避免广播风暴等。
【实训设备】s3100(2台),PC(2台)、直连线(4条)【主要命令】stp, stp mode , spanning-tree Priority, undo stp【实训步骤】1、在每台交换机上开启生成树协议.对 SwitchA 做如下配置:<H3C><H3C> system-view !进入全局配置模式[H3C]sysname SwitchA[SwitchA]vlan 10[SwitchA-vlan10]quit[SwitchA]interface fastethernet 0/24[SwitchA- fastethernet 0/24] port acc vlan 10[SwitchA] interface f 0/1[SwitchA-fastethernet]port link-type trunk[SwitchA] interface f 0/2[SwitchA-fastethernet]port link-type trunk[SwitchA-fastethernet]quit[SwitchA]对 SwitchB 做如下配置:<H3C><H3C> system-view !进入全局配置模式[H3C]sysname SwitchB[SwitchB]vlan 10[SwitchB –vlan10]quit[SwitchB]interface fastethernet 0/24[SwitchB-fastethernet] port acc vlan 10[SwitchB]interface f 0/1[SwitchB-fastetherne] port link-type trunk[SwitchB]interface f 0/2[SwitchB-fastetherne] port link-type trunk[SwitchB-fastetherne] quit[SwitchB]2、设置生成树模式。
stp mode stp!设置生成树模式为 STP (802.1D)验证测试:验证生成树协模式为 802.1D<SwitchA>sys[SwitchA]stp enable !开启生成树协议[SwitchA] stp mode stp[SwitchA]quit<SwitchB>sys[SwitchB]stp enable !开启生成树协议[SwitchB] stp mode stp[SwitchB]quit验证测试:验证生成树协议已经开启SwitchA#disp stp-------[CIST Global Info][Mode STP]-------CIST Bridge :32768.000f-e253-8317 本机桥IDBridge Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20 CIST Root/ERPC :32768.000f-e249-d546 / 200 根桥ID及路径开销CIST RegRoot/IRPC :32768.000f-e253-8317 / 0CIST RootPortId :128.1 短口IDBPDU-Protection :disabledTC-Protection :enabled / Threshold=6Bridge ConfigDigest Snooping :disabledTC or TCN received :122Time since last TC :0 days 0h:0m:9s----[Port1(Ethernet1/0/1)][FORWARDING]---- 发送状态Port Protocol :enabledPort Role :CIST Root PortPort Priority :128Port Cost(Legacy) :Config=auto / Active=200Desg. Bridge/Port :32768.000f-e249-d546 / 128.1Port Edged :Config=disabled / Active=disabledPoint-to-point :Config=auto / Active=trueTransmit Limit :10 packets/hello-timeProtection Type :NoneMSTP BPDU format :Config=legacyPort ConfigDigest Snooping :disabledNum of Vlans Mapped :1PortTimes :Hello 2s MaxAge 20s FwDly 15s MsgAge 0s RemHop 0 BPDU Sent :3TCN: 1, Config: 2, RST: 0, MST: 0BPDU Received :39TCN: 0, Config: 39, RST: 0, MST: 0----[Port2(Ethernet1/0/2)][DISCARDING]---- 阻塞状态Port Protocol :enabledPort Role :CIST Alternate PortPort Priority :128Port Cost(Legacy) :Config=auto / Active=200Desg. Bridge/Port :32768.000f-e249-d546 / 128.2Port Edged :Config=disabled / Active=disabledPoint-to-point :Config=auto / Active=trueTransmit Limit :10 packets/hello-timeProtection Type :NoneMSTP BPDU format :Config=legacyPort ConfigDigest Snooping :disabledNum of Vlans Mapped :1PortTimes :Hello 2s MaxAge 20s FwDly 15s MsgAge 0s RemHop 0 BPDU Sent :2TCN: 0, Config: 2, RST: 0, MST: 0BPDU Received :59TCN: 0, Config: 59, RST: 0, MST: 0[SwitchA] disp stp int e1/0/1 显示接口STP信息----[CIST][Port1(Ethernet1/0/1)][FORWARDING]----Port Protocol :enabledPort Role :CIST Root PortPort Priority :128 接口优先级Port Cost(Legacy) :Config=auto / Active=200Desg. Bridge/Port :32768.000f-e249-d546 / 128.1Port Edged :Config=disabled / Active=disabledPoint-to-point :Config=auto / Active=trueTransmit Limit :10 packets/hello-timeProtection Type :NoneMSTP BPDU format :Config=legacyPort ConfigDigest Snooping :disabledNum of Vlans Mapped :1PortTimes :Hello 2s MaxAge 20s FwDly 15s MsgAge 0s RemHop 0BPDU Sent :3TCN: 1, Config: 2, RST: 0, MST: 0BPDU Received :195TCN: 0, Config: 195, RST: 0, MST: 03、设置交换机的优先级。
[SwitchA] stp priority 0 !设置交换机 SwitchA 在生成树实例0中的优先级为0, 数值最小的交换机为根交换机(也称根桥),交换机 SwitchB 的优先级采用默认优先级(32768),因此 SwitchA 将成为根交换机。
验证测试:验证交换机 SwitchA 的优先级[SwitchA]display stpStpVersion : STPSysStpStatus : EnabledBaseNumPorts : 24MaxAge : 20HelloTime : 2ForwardDelay : 15BridgeMaxAge : 20BridgeHelloTime : 2BridgeForwardDelay : 15MaxHops : 20TxHoldCount : 3PathCostMethod : LongBPDUGuard : DisabledBPDUFilter : DisabledBridgeAddr : 00d0.f88c.1da0Priority : 0TimeSinceTopologyChange : 0d:0h:7m:21sTopologyChanges : 0DesignatedRoot : 000000D0F88C1DA0RootCost : 0RootPort : 0[SwitchB] dis stp-------[CIST Global Info][Mode STP]-------CIST Bridge :32768.000f-e249-d546 本机桥IDBridge Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20CIST Root/ERPC :32768.000f-e249-d546 / 0 根桥ID及路径开销CIST RegRoot/IRPC :32768.000f-e249-d546 / 0CIST RootPortId :0.0BPDU-Protection :disabledTC-Protection :enabled / Threshold=6Bridge ConfigDigest Snooping :disabledTC or TCN received :5Time since last TC :0 days 0h:3m:11s----[Port1(Ethernet1/0/1)][FORWARDING]----Port Protocol :enabledPort Role :CIST Designated PortPort Priority :128Port Cost(Legacy) :Config=auto / Active=200Desg. Bridge/Port :32768.000f-e249-d546 / 128.1Port Edged :Config=disabled / Active=disabledPoint-to-point :Config=auto / Active=trueTransmit Limit :10 packets/hello-timeProtection Type :NoneMSTP BPDU format :Config=legacyPort ConfigDigest Snooping :disabledNum of Vlans Mapped :1PortTimes :Hello 2s MaxAge 20s FwDly 15s MsgAge 0s RemHop 20 BPDU Sent :114TCN: 0, Config: 114, RST: 0, MST: 0BPDU Received :1TCN: 1, Config: 0, RST: 0, MST: 0----[Port2(Ethernet1/0/2)][FORWARDING]----Port Protocol :enabledPort Role :CIST Designated PortPort Priority :128Port Cost(Legacy) :Config=auto / Active=200Desg. Bridge/Port :32768.000f-e249-d546 / 128.2Port Edged :Config=disabled / Active=disabledPoint-to-point :Config=auto / Active=trueTransmit Limit :10 packets/hello-timeProtection Type :NoneMSTP BPDU format :Config=legacyPort ConfigDigest Snooping :disabledNum of Vlans Mapped :1PortTimes :Hello 2s MaxAge 20s FwDly 15s MsgAge 0s RemHop 20 BPDU Sent :132TCN: 0, Config: 132, RST: 0, MST: 0BPDU Received :0TCN: 0, Config: 0, RST: 0, MST: 04、综合验证测试。