1》sw3#show spanning-tree
VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    32769
             Address     000A.F339.1927
             This bridge is the root
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     000A.F339.1927
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/1            Desg FWD 19        128.1    P2p
Fa0/2            Desg FWD 19        128.2    P2p

VLAN0002
  Spanning tree enabled protocol ieee
  Root ID    Priority    32770
             Address     000A.F339.1927
             This bridge is the root
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32770  (priority 32768 sys-id-ext 2)
             Address     000A.F339.1927
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
图中S3是VLAN1和VLAN2的跟桥,为什么?
这存在一个问题,跟桥的选择顺序?
1>选取跟桥:最低的跟桥ID(网桥优先级(32768+MAC地址))
2>最低的根路径代价,选定为根口

2》首先他们的网桥优先级都是32768
其次他们的MAC地址分别是
S1:00e0.a39b.486c
S2:0040.0bce.8484
S3:000a.f339.1927
所以按照选择跟桥的原则,那么S3肯定就是根桥了
从结果中还能反映出来一些其他的信息
交换机的端口类别:根口(root)、指定口(Desg)、
阻断口(Altn)。
交换机的端口状态:禁用(disable)、阻塞(Blocking)、
监听状态(Listening)、学习(Learning)、转发(Forwarding)
每台非跟桥要选举一条到跟桥的根路径。STP使用路径cost来决定
到达跟桥的最佳路径(cost是累加的,带宽大的链路COST低),最低
COST值的路径就是根路径,该接口就是根口。

3》现在的问题是在此图中让S3称为跟桥是不合理的,比如怎么让S1作为VLAN 2
的跟桥。
sw1(config)#spanning-tree vlan 2 priority 4096
VLAN0002
  Spanning tree enabled protocol ieee
  Root ID    Priority    4098
             Address     00E0.A39B.486C
             This bridge is the root
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    4098  (priority 4096 sys-id-ext 2)
             Address     00E0.A39B.486C
从结果中可以看出来,SW1称为了VLAN 2的根桥,而S3仍然为VLAN1的根桥。