实验过程:

第一步:配置sw1接口 sw1(config)#int ran f2/13 -14 sw1(config-if-range)#no sh sw1(config-if-range)#sw mo trunk

第二步:配置SW2接口 sw2(config)#int range f2/13 -14 sw2(config-if-range)#sw mo trunk sw2(config-if-range)#no sh

第三步:在交换机上查看stp的运行情况

sw1# sh spanning-tree

VLAN1 is executing the ieee compatible Spanning Tree protocol Bridge Identifier has priority 32768, address ccf8.0f24.0000 //优先级,的mac地址 Configured hello time 2, max age 20, forward delay 15 We are the root of the spanning tree //在这个stp中我们为根桥 Topology change flag not set, detected flag not set Number of topology changes 1 last change occurred 00:03:19 ago from FastEthernet2/13 Times: hold 1, topology change 35, notification 2 hello 2, max age 20, forward delay 15 Timers: hello 1, topology change 0, notification 0, aging 0

Port 94 (FastEthernet2/13) of VLAN1 is forwarding //f2/13口在活动状态 Port path cost 19, Port priority 128, Port Identifier 128.94. Designated root has priority 32768, address ccf8.0f24.0000 Designated bridge has priority 32768, address ccf8.0f24.0000 Designated port id is 128.94, designated path cost 0 Timers: message age 0, forward delay 0, hold 0 Number of transitions to forwarding state: 1 BPDU: sent 236, received 7

Port 95 (FastEthernet2/14) of VLAN1 is forwarding //此接口为活动状态 Port path cost 19, Port priority 128, Port Identifier 128.95. Designated root has priority 32768, address ccf8.0f24.0000 Designated bridge has priority 32768, address ccf8.0f24.0000 Designated port id is 128.95, designated path cost 0 Timers: message age 0, forward delay 0, hold 0 Number of transitions to forwarding state: 1 BPDU: sent 241, received 14

w2#sh spanning-tree

VLAN1 is executing the ieee compatible Spanning Tree protocol Bridge Identifier has priority 32768, address ccf9.0f28.0000 //这个桥的优先级和mac地址 Configured hello time 2, max age 20, forward delay 15 Current root has priority 32768, address ccf8.0f24.0000 //根桥的优先级和mac地址 Root port is 94 (FastEthernet2/13), cost of root path is 19 Topology change flag not set, detected flag not set Number of topology changes 0 last change occurred 00:03:41 ago Times: hold 1, topology change 35, notification 2 hello 2, max age 20, forward delay 15 Timers: hello 0, topology change 0, notification 0, aging 0

Port 94 (FastEthernet2/13) of VLAN1 is forwarding //此接口为活动状态 Port path cost 19, Port priority 128, Port Identifier 128.94. Designated root has priority 32768, address ccf8.0f24.0000 Designated bridge has priority 32768, address ccf8.0f24.0000 Designated port id is 128.94, designated path cost 0 Timers: message age 1, forward delay 0, hold 0 Number of transitions to forwarding state: 1 BPDU: sent 1, received 106

Port 95 (FastEthernet2/14) of VLAN1 is blocking //sw2上f2/24的接口被阻塞 Port path cost 19, Port priority 128, Port Identifier 128.95. Designated root has priority 32768, address ccf8.0f24.0000 Designated bridge has priority 32768, address ccf8.0f24.0000 Designated port id is 128.95, designated path cost 0 Timers: message age 4, forward delay 0, hold 0 Number of transitions to forwarding state: 0 BPDU: sent 18, received 11