STPの実験

pty:32768
mac:0004.2xxx.0ec0
   +----+10
   |24_1+--------------+
   +--+-+              |
      |2               |
      |                |
      |2               |10(X)
   +--+-+           +--+-+
   |24_2+-----------+12_1|
   +----+6         6+----+
  pty:32768            pty:32768
  mac:0003.fxxx.8580   mac:0004.9xxx.23c0
  ROOT

デフォルトの設定だと、24_2のMACが最小なのでルートになる。

各switchでの、show spanning-treeの結果(最初の部分だけ)
cata2924_01#sho spanning-tree

Spanning tree 1 is executing the IEEE compatible Spanning Tree protocol
Bridge Identifier has priority 32768, address 0004.2xxx.0ec0 ※自分のmac
Configured hello time 2, max age 20, forward delay 15
Current root has priority 32768, address 0003.fe67.8580 ※root bridgeのMAC
Root port is 14, cost of root path is 19
Topology change flag not set, detected flag not set, changes 15
Times: hold 1, topology change 35, notification 2
hello 2, max age 20, forward delay 15
Timers: hello 0, topology change 0, notification 0





cata2924_02#sho spanning-tree

Spanning tree 1 is executing the IEEE compatible Spanning Tree protocol
Bridge Identifier has priority 32768, address 0003.fxxx.8580 ※自分のMAC
Configured hello time 2, max age 20, forward delay 15
We are the root of the spanning tree ※自分がrootである
Topology change flag not set, detected flag not set, changes 14
Times: hold 1, topology change 35, notification 2
hello 2, max age 20, forward delay 15
Timers: hello 1, topology change 0, notification 0

cata2912_01#sho spanning-tree

Spanning tree 1 is executing the IEEE compatible Spanning Tree protocol
Bridge Identifier has priority 32768, address 0004.9xxx.23c0 ※自分のMAC
Configured hello time 2, max age 20, forward delay 15
Current root has priority 32768, address 0003.fxxx.8580 ※rootのMAC
Root port is 18, cost of root path is 19
Topology change flag not set, detected flag not set, changes 14
Times: hold 1, topology change 35, notification 2
hello 2, max age 20, forward delay 15
Timers: hello 0, topology change 0, notification 0

ここでdebugを有効にしてから、24_1と12_1間のケーブルを抜いて、さして見る。
cata2924_01#debug spantree events
Spanning Tree event debugging is on
cata2924_01#
02:48:08: %LINK-3-UPDOWN: Interface FastEthernet0/10, changed state to down
02:48:08: ST: sent Topology Change Notice on FastEthernet0/2 vlan 1
02:48:08: ST: FastEthernet0/10 vlan 1 -> blocking
02:48:09: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/10, changed state to down
02:48:16: %LINK-3-UPDOWN: Interface FastEthernet0/10, changed state to up
02:48:16: ST: FastEthernet0/10 vlan 1 -> listening
02:48:17: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/10, changed state to up
02:48:31: ST: FastEthernet0/10 vlan 1 -> learning
02:48:47: ST: sent Topology Change Notice on FastEthernet0/2 vlan 1
02:48:47: ST: FastEthernet0/10 vlan 1 -> forwarding
cata2924_01#

listening -> learning -> forwarding まで15秒ずつ、合計30秒かかっている。 15というのはforward delay の値である。それでは、24_1で、forward delayの値を変えて見よう。
cata2924_01(config)#spanning-tree forward-time 18

cata2924_01#
02:52:07: %SYS-5-CONFIG_I: Configured from console by consolesho spa
cata2924_01#sho spanning-tree

Spanning tree 1 is executing the IEEE compatible Spanning Tree protocol
Bridge Identifier has priority 32768, address 0004.2xxx.0ec0
Configured hello time 2, max age 20, forward delay 18
Current root has priority 32768, address 0003.fxxx.8580
Root port is 14, cost of root path is 19
Topology change flag not set, detected flag not set, changes 20
Times: hold 1, topology change 35, notification 2
hello 2, max age 20, forward delay 15
Timers: hello 0, topology change 0, notification 0

2箇所あるforward delayのうち、Configuredで始まる行の方だけが、変更した値になっている。それではまた先ほどのようにケーブルを抜き差ししてみよう。
cata2924_01#

02:54:17: %LINK-3-UPDOWN: Interface FastEthernet0/10, changed state to down
02:54:17: ST: sent Topology Change Notice on FastEthernet0/2 vlan 1
02:54:17: ST: FastEthernet0/10 vlan 1 -> blocking
02:54:18: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/10, changed state to down
02:54:23: %LINK-3-UPDOWN: Interface FastEthernet0/10, changed state to up
02:54:23: ST: FastEthernet0/10 vlan 1 -> listening
02:54:24: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/10, changed state to up
02:54:38: ST: FastEthernet0/10 vlan 1 -> learning
02:54:53: ST: sent Topology Change Notice on FastEthernet0/2 vlan 1
02:54:53: ST: FastEthernet0/10 vlan 1 -> forwarding

各stateの間隔は15秒のままである。他のスイッチのshow spanning-treeの結果をみても、15秒のままになっている。timerの値はrootで変更しなければ反映しない。
cata2924_02#conf t

Enter configuration commands, one per line. End with CNTL/Z.
cata2924_02(config)#spanning-tree forward-time 18
cata2924_02(config)#end
cata2924_02#sho spanning-tree

Spanning tree 1 is executing the IEEE compatible Spanning Tree protocol
Bridge Identifier has priority 32768, address 0003.fxxx.8580
Configured hello time 2, max age 20, forward delay 18
We are the root of the spanning tree
Topology change flag not set, detected flag not set, changes 20
Times: hold 1, topology change 38, notification 2
hello 2, max age 20, forward delay 18
Timers: hello 0, topology change 0, notification 0

forward delayの変更が反映された。 他のスイッチでもConfiguredのところは各自のconfigのままで、 下のほうにある値に反映されている。
cata2924_01#sho spanning-tree

Spanning tree 1 is executing the IEEE compatible Spanning Tree protocol
Bridge Identifier has priority 32768, address 0004.2xxx.0ec0
Configured hello time 2, max age 20, forward delay 15
Current root has priority 32768, address 0003.fxxx.8580
Root port is 14, cost of root path is 19
Topology change flag not set, detected flag not set, changes 22
Times: hold 1, topology change 35, notification 2
hello 2, max age 20, forward delay 18
Timers: hello 0, topology change 0, notification 0





cata2912_01#sho spanning-tree

Spanning tree 1 is executing the IEEE compatible Spanning Tree protocol
Bridge Identifier has priority 32768, address 0004.9xxx.23c0
Configured hello time 2, max age 20, forward delay 15
Current root has priority 32768, address 0003.fe67.8580
Root port is 18, cost of root path is 19
Topology change flag not set, detected flag not set, changes 20
Times: hold 1, topology change 35, notification 2
hello 2, max age 20, forward delay 18
Timers: hello 0, topology change 0, notification 0

もう一度ケーブルの抜き差しをしてみると
cata2924_01#

03:05:10: %LINK-3-UPDOWN: Interface FastEthernet0/10, changed state to down
03:05:10: ST: sent Topology Change Notice on FastEthernet0/2 vlan 1
03:05:10: ST: FastEthernet0/10 vlan 1 -> blocking
03:05:11: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/10, changed state to down
03:05:14: %LINK-3-UPDOWN: Interface FastEthernet0/10, changed state to up
03:05:14: ST: FastEthernet0/10 vlan 1 -> listening
03:05:15: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/10, changed state to up
03:05:32: ST: FastEthernet0/10 vlan 1 -> learning
03:05:51: ST: sent Topology Change Notice on FastEthernet0/2 vlan 1
03:05:51: ST: FastEthernet0/10 vlan 1 -> forwarding

各stateの間隔が18秒になった。 timer値を変える場合はrootで変えなければならない。 ただし、むやみに変えるのはよくないそうです。