STP端口的选择
 
 
 
 
 
sw1#show     sp  vlan  1 <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 VLAN1 is executing the ieee compatible Spanning Tree protocol

  Bridge Identifier has priority 1, address cc00.0fec.0000

  Configured hello time 2, max age 20, forward delay 15

  We are the root of the spanning tree

  Topology change flag not set, detected flag not set

  Number of topology changes 4 last change occurred 00:24:53 ago

          from FastEthernet0/0

  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 1 (FastEthernet0/0) of VLAN1 is forwarding

   Port path cost 19, Port priority 128, Port Identifier 128.1.

   Designated root has priority 1, address cc00.0fec.0000

   Designated bridge has priority 1, address cc00.0fec.0000

   Designated port id is 128.1, designated path cost 0

   Timers: message age 0, forward delay 0, hold 0

   Number of transitions to forwarding state: 1

   BPDU: sent 835, received 8

 Port 12 (FastEthernet0/11) of VLAN1 is forwarding

   Port path cost 19, Port priority 128, Port Identifier 128.12.

   Designated root has priority 1, address cc00.0fec.0000

   Designated bridge has priority 1, address cc00.0fec.0000

   Designated port id is 128.12, designated path cost 0

   Timers: message age 0, forward delay 0, hold 0

   Number of transitions to forwarding state: 1

   BPDU: sent 826, received 2

sw2#show       sp vlan  1

 VLAN1 is executing the ieee compatible Spanning Tree protocol

  Bridge Identifier has priority 2, address cc00.0110.0000

  Configured hello time 2, max age 20, forward delay 15

  Current root has priority 1, address cc00.0fec.0000

  Root port is 2 (FastEthernet0/1), cost of root path is 19

  Topology change flag not set, detected flag not set

  Number of topology changes 8 last change occurred 00:23:59 ago

          from FastEthernet0/2

  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 2 (FastEthernet0/1) of VLAN1 is forwarding

   Port path cost 19, Port priority 128, Port Identifier 128.2.

   Designated root has priority 1, address cc00.0fec.0000

   Designated bridge has priority 1, address cc00.0fec.0000

   Designated port id is 128.1, designated path cost 0

   Timers: message age 1, forward delay 0, hold 0

   Number of transitions to forwarding state: 1

   BPDU: sent 8, received 813

 Port 3 (FastEthernet0/2) of VLAN1 is forwarding

   Port path cost 19, Port priority 128, Port Identifier 128.3.

   Designated root has priority 1, address cc00.0fec.0000

   Designated bridge has priority 2, address cc00.0110.0000

   Designated port id is 128.3, designated path cost 19

   Timers: message age 0, forward delay 0, hold 0

   Number of transitions to forwarding state: 1

   BPDU: sent 814, received 6

sw3#show   sp vlan 1

 VLAN1 is executing the ieee compatible Spanning Tree protocol

  Bridge Identifier has priority 3, address cc00.0cb4.0000

  Configured hello time 2, max age 20, forward delay 15

  Current root has priority 1, address cc00.0fec.0000

  Root port is 4 (FastEthernet0/3), cost of root path is 37

  Topology change flag not set, detected flag not set

  Number of topology changes 6 last change occurred 00:24:06 ago

          from FastEthernet0/4

  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 4 (FastEthernet0/3) of VLAN1 is forwarding

   Port path cost 18, Port priority 128, Port Identifier 128.4.

   Designated root has priority 1, address cc00.0fec.0000

   Designated bridge has priority 2, address cc00.0110.0000

   Designated port id is 128.3, designated path cost 19

   Timers: message age 3, forward delay 0, hold 0

   Number of transitions to forwarding state: 1

   BPDU: sent 6, received 795

 Port 5 (FastEthernet0/4) of VLAN1 is forwarding

   Port path cost 19, Port priority 128, Port Identifier 128.5.

   Designated root has priority 1, address cc00.0fec.0000

   Designated bridge has priority 3, address cc00.0cb4.0000

   Designated port id is 128.5, designated path cost 37

   Timers: message age 0, forward delay 0, hold 0

   Number of transitions to forwarding state: 1

   BPDU: sent 797, received 4

sw4#show  sp  vlan  1

 VLAN1 is executing the ieee compatible Spanning Tree protocol

  Bridge Identifier has priority 4, address cc00.0a74.0000

  Configured hello time 2, max age 20, forward delay 15

  Current root has priority 1, address cc00.0fec.0000

  Root port is 6 (FastEthernet0/5), cost of root path is 56

  Topology change flag not set, detected flag not set

  Number of topology changes 6 last change occurred 00:03:47 ago

          from FastEthernet0/6

  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 6 (FastEthernet0/5) of VLAN1 is forwarding

   Port path cost 19, Port priority 128, Port Identifier 128.6.

   Designated root has priority 1, address cc00.0fec.0000

   Designated bridge has priority 3, address cc00.0cb4.0000

   Designated port id is 128.5, designated path cost 37

   Timers: message age 4, forward delay 0, hold 0

   Number of transitions to forwarding state: 1

   BPDU: sent 6, received 945

 Port 7 (FastEthernet0/6) of VLAN1 is forwarding

   Port path cost 19, Port priority 128, Port Identifier 128.7.

   Designated root has priority 1, address cc00.0fec.0000

   Designated bridge has priority 4, address cc00.0a74.0000

   Designated port id is 128.7, designated path cost 56

   Timers: message age 0, forward delay 0, hold 0

   Number of transitions to forwarding state: 2

   BPDU: sent 182, received 753

sw5#show    sp   vlan  1

 VLAN1 is executing the ieee compatible Spanning Tree protocol

  Bridge Identifier has priority 5, address cc00.0b00.0000

  Configured hello time 2, max age 20, forward delay 15

  Current root has priority 1, address cc00.0fec.0000

  Root port is 9 (FastEthernet0/8), cost of root path is 58

  Topology change flag not set, detected flag not set

  Number of topology changes 2 last change occurred 00:22:36 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 8 (FastEthernet0/7) of VLAN1 is blocking

   Port path cost 19, Port priority 128, Port Identifier 128.8.

   Designated root has priority 1, address cc00.0fec.0000

   Designated bridge has priority 4, address cc00.0a74.0000

   Designated port id is 128.7, designated path cost 56

   Timers: message age 5, forward delay 0, hold 0

   Number of transitions to forwarding state: 1

   BPDU: sent 758, received 711

 Port 9 (FastEthernet0/8) of VLAN1 is forwarding

   Port path cost 29, Port priority 128, Port Identifier 128.9.

   Designated root has priority 1, address cc00.0fec.0000

   Designated bridge has priority 6, address cc00.039c.0000

   Designated port id is 128.10, designated path cost 29

   Timers: message age 3, forward delay 0, hold 0

   Number of transitions to forwarding state: 1

   BPDU: sent 33, received 1445

sw6#show   spanning-tree   vlan  1

 VLAN1 is executing the ieee compatible Spanning Tree protocol

  Bridge Identifier has priority 6, address cc00.039c.0000

  Configured hello time 2, max age 20, forward delay 15

  Current root has priority 1, address cc00.0fec.0000

  Root port is 11 (FastEthernet0/10), cost of root path is 29

  Topology change flag set, detected flag not set

  Number of topology changes 2 last change occurred 00:00:20 ago

          from FastEthernet0/9

  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 10 (FastEthernet0/9) of VLAN1 is forwarding

   Port path cost 19, Port priority 128, Port Identifier 128.10.

   Designated root has priority 1, address cc00.0fec.0000

   Designated bridge has priority 6, address cc00.039c.0000

   Designated port id is 128.10, designated path cost 29

   Timers: message age 0, forward delay 0, hold 0

   Number of transitions to forwarding state: 1

   BPDU: sent 778, received 3

 Port 11 (FastEthernet0/10) of VLAN1 is forwarding

   Port path cost 29, Port priority 128, Port Identifier 128.11.

   Designated root has priority 1, address cc00.0fec.0000

   Designated bridge has priority 1, address cc00.0fec.0000

   Designated port id is 128.12, designated path cost 0

   Timers: message age 2, forward delay 0, hold 0

   Number of transitions to forwarding state: 1

   BPDU: sent 3, received 776

    在此例中,F0/7端口将被阻塞,如果所有端口的COST值都改为19,则F0/6端口将被阻塞。以后者为例,如果所有端口的COST值都是19,则SW1为根网桥,而端口F0/1、F0/3、F0/5、F0/8、F0/10为各自所在网桥的根端口,阻塞端口将在F0/6和F0/7之间选择一个。选择的依据就是端口到根桥的路径开销,开销小的为指定端口,开销大的为阻塞端口。

每台非根桥的交换机上都会被选出一个根端口,与根端口相连的那个端口所在的交换机为这个根端口的指定网桥。比如F0/5为SW4的根端口,与F0/5相连的端口为SW3的F0/4端口,则SW3即为F0/5的指定网桥( Designated bridge )。在生成树计算的过程中,对于非根端口而言,交换机会认为自己本身为其指定网桥,也就是说F0/6的指定网桥就是SW4。非根网桥在选出根端口后会为其它端口计算出一个值,这个值由根网桥ID、该端口到根网桥的路径开销( designated path cost )、指定网桥ID、指定端口组成。

该端口到根网桥的路径开销( designated path cost ):其值等于根端口到根网桥的路径开                 销。    

指定网桥:为该端口所在的网桥

    指定端口:为该端口

    比如:F0/6其值为(SW1,57,SW4,F0/6)  F0/7的值为(SW1,38,SW5,F0/7)

    比较一下就知道F0/6会被阻塞。

    以上图为例:

    F0/6(SW1,56,SW4,F0/6)    F0/7(SW1,58,SW4,F0/7)

    比较得知F0/7将被阻塞。