🌲

STP の練習

2022/12/28に公開

本エントリについて

Dynagen、Dynamips を使って、STP を練習します。
Dynagen、Dynamips の利用環境はすでに整っているものとします。

環境について

sw01 と sw02 間で、trunk ポートに設定した fa1/14、fa1/15 同士を結線して、STP の動作を確認します。
fa1/15 間の結線は後ほど実施します。

[pc0] .1 (vlan10) fa1/0 [sw01] fa1/14 === fa1/14 [sw02] fa1/0 (vlan10) .2 pc2
[pc1] .2 (vlan11) fa1/4        fa1/15     fa1/15        fa1/4 (vlan11) .2 pc3
Dynagen 設定ファイル抜粋
    [[ROUTER sw02]]
        model = 3725
        slot1 = NM-16ESW
        f1/0 = NIO_udp:30000:127.0.0.1:20000
        f1/4 = NIO_udp:30002:127.0.0.1:20002
        f1/14 = sw01 f1/14
    [[ROUTER sw01]]
        model = 3725
        slot1 = NM-16ESW
        f1/0 = nio_tap:tap0
        f1/4 = NIO_udp:30001:127.0.0.1:20001
        f1/14 = sw02 f1/14

基本設定

sw01

sw01 で VLAN10、VLAN11 を作成します。
f1/14 を trunk ポートに設定します。

sw01#show int trunk

Port      Mode         Encapsulation  Status        Native vlan
Fa1/14    on           802.1q         trunking      1

Port      Vlans allowed on trunk
Fa1/14    1-4094

Port      Vlans allowed and active in management domain
Fa1/14    1,10-11

Port      Vlans in spanning tree forwarding state and not pruned
Fa1/14    1

sw01#show int status

Port    Name               Status       Vlan       Duplex Speed Type
Fa1/0                      connected    1          a-full   a-100 10/100BaseTX
Fa1/1                      notconnect   1            auto    auto 10/100BaseTX
Fa1/2                      notconnect   1            auto    auto 10/100BaseTX
Fa1/3                      notconnect   1            auto    auto 10/100BaseTX
Fa1/4                      connected    1          a-full   a-100 10/100BaseTX
Fa1/5                      notconnect   1            auto    auto 10/100BaseTX
Fa1/6                      notconnect   1            auto    auto 10/100BaseTX
Fa1/7                      notconnect   1            auto    auto 10/100BaseTX
Fa1/8                      notconnect   1            auto    auto 10/100BaseTX
Fa1/9                      notconnect   1            auto    auto 10/100BaseTX
Fa1/10                     notconnect   1            auto    auto 10/100BaseTX
Fa1/11                     notconnect   1            auto    auto 10/100BaseTX
Fa1/12                     notconnect   1            auto    auto 10/100BaseTX
Fa1/13                     notconnect   1            auto    auto 10/100BaseTX
Fa1/14                     connected    trunk      a-full   a-100 10/100BaseTX
Fa1/15                     notconnect   1            auto    auto 10/100BaseTX

STPの状態を確認します。

sw01#show spanning-tree summary
Root bridge for: VLAN1, VLAN10, VLAN11.
PortFast BPDU Guard is disabled
UplinkFast is disabled
BackboneFast is disabled

Name                 Blocking Listening Learning Forwarding STP Active
-------------------- -------- --------- -------- ---------- ----------
VLAN1                0        0         0        3          3
VLAN10               0        0         0        1          1
VLAN11               0        0         0        1          1
-------------------- -------- --------- -------- ---------- ----------
             3 VLANs 0        0         0        5          5

VLAN1、VLAN10、VLAN11 とも sw01 が root ブリッジとなっています。

sw01#show spanning-tree brief                                                                                                                                                                                                         [2/568]

VLAN1
  Spanning tree enabled protocol ieee
  Root ID    Priority    32768
             Address     c200.0347.0000
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32768
             Address     c200.0347.0000
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/0      128.41   128    19 FWD     0 32768 c200.0347.0000 128.41
FastEthernet1/4      128.45   128    19 FWD     0 32768 c200.0347.0000 128.45
FastEthernet1/14     128.55   128    19 FWD     0 32768 c200.0347.0000 128.55


VLAN10
  Spanning tree enabled protocol ieee
  Root ID    Priority    32768
             Address     c200.0347.0001
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32768
             Address     c200.0347.0001
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/14     128.55   128    19 FWD     0 32768 c200.0347.0001 128.55

VLAN11
  Spanning tree enabled protocol ieee
  Root ID    Priority    32768
             Address     c200.0347.0002
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32768
             Address     c200.0347.0002
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/14     128.55   128    19 FWD     0 32768 c200.0347.0002 128.55

sw02

sw02 でも同様に VLAN10、VLAN11 を作成し、f1/14 を trunk ポートに設定します。

sw02#show int trunk

Port      Mode         Encapsulation  Status        Native vlan
Fa1/14    on           802.1q         trunking      1

Port      Vlans allowed on trunk
Fa1/14    1-4094

Port      Vlans allowed and active in management domain
Fa1/14    1,10-11

Port      Vlans in spanning tree forwarding state and not pruned
Fa1/14    1
sw02#
sw02#show int status

Port    Name               Status       Vlan       Duplex Speed Type
Fa1/0                      connected    1          a-full   a-100 10/100BaseTX
Fa1/1                      notconnect   1            auto    auto 10/100BaseTX
Fa1/2                      notconnect   1            auto    auto 10/100BaseTX
Fa1/3                      notconnect   1            auto    auto 10/100BaseTX
Fa1/4                      connected    1          a-full   a-100 10/100BaseTX
Fa1/5                      notconnect   1            auto    auto 10/100BaseTX
Fa1/6                      notconnect   1            auto    auto 10/100BaseTX
Fa1/7                      notconnect   1            auto    auto 10/100BaseTX
Fa1/8                      notconnect   1            auto    auto 10/100BaseTX
Fa1/9                      notconnect   1            auto    auto 10/100BaseTX
Fa1/10                     notconnect   1            auto    auto 10/100BaseTX
Fa1/11                     notconnect   1            auto    auto 10/100BaseTX
Fa1/12                     notconnect   1            auto    auto 10/100BaseTX
Fa1/13                     notconnect   1            auto    auto 10/100BaseTX
Fa1/14                     connected    trunk      a-full   a-100 10/100BaseTX
Fa1/15                     notconnect   1            auto    auto 10/100BaseTX

STPの状態を確認します。

sw02#show spanning-tree summary
Root bridge for: none.
PortFast BPDU Guard is disabled
UplinkFast is disabled
BackboneFast is disabled

Name                 Blocking Listening Learning Forwarding STP Active
-------------------- -------- --------- -------- ---------- ----------
VLAN1                0        0         0        3          3
VLAN10               0        0         0        1          1
VLAN11               0        0         0        1          1
-------------------- -------- --------- -------- ---------- ----------
             3 VLANs 0        0         0        5          5


VLAN1、VLAN10、VLAN11 とも sw02 は root ブリッジではありません。
冗長回線がないので、ブロッキングになっているポートはありません。

sw02#show spanning-tree brief                                                                                                                                                                                                         [4/586]

VLAN1
  Spanning tree enabled protocol ieee
  Root ID    Priority    32768
             Address     c200.0347.0000
             Cost        19
             Port        55 (FastEthernet1/14)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32768
             Address     c201.0347.0000
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/0      128.41   128    19 FWD    19 32768 c201.0347.0000 128.41
FastEthernet1/4      128.45   128    19 FWD    19 32768 c201.0347.0000 128.45
FastEthernet1/14     128.55   128    19 FWD     0 32768 c200.0347.0000 128.55


VLAN10
  Spanning tree enabled protocol ieee
  Root ID    Priority    32768
             Address     c200.0347.0001
             Cost        19
             Port        55 (FastEthernet1/14)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32768
             Address     c201.0347.0001
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/14     128.55   128    19 FWD     0 32768 c200.0347.0001 128.55


VLAN11
  Spanning tree enabled protocol ieee
  Root ID    Priority    32768
             Address     c200.0347.0002
             Cost        19
             Port        55 (FastEthernet1/14)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32768
             Address     c201.0347.0002
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/14     128.55   128    19 FWD     0 32768 c200.0347.0002 128.55

冗長回線の追加

sw01、sw02 の fa1/15 で trunk ポートの設定をします。
設定したら、dynagen で fa1/15 同士を結線します。

=> conf
=>(config)hypervisor 127.0.0.1:7200
=>(config-127.0.0.1:7200)router sw01
=>(config-127.0.0.1:7200-router sw01)f1/15 = sw02 fa1/15

結線後の状態を確認します。

sw01#show int trunk

Port      Mode         Encapsulation  Status        Native vlan
Fa1/14    on           802.1q         trunking      1
Fa1/15    on           802.1q         trunking      1

Port      Vlans allowed on trunk
Fa1/14    1-4094
Fa1/15    1-4094

Port      Vlans allowed and active in management domain
Fa1/14    1,10-11
Fa1/15    1,10-11

Port      Vlans in spanning tree forwarding state and not pruned
Fa1/14    1
Fa1/15    1

sw01#show int status

Port    Name               Status       Vlan       Duplex Speed Type
Fa1/0                      connected    1          a-full   a-100 10/100BaseTX
Fa1/1                      notconnect   1            auto    auto 10/100BaseTX
Fa1/2                      notconnect   1            auto    auto 10/100BaseTX
Fa1/3                      notconnect   1            auto    auto 10/100BaseTX
Fa1/4                      connected    1          a-full   a-100 10/100BaseTX
Fa1/5                      notconnect   1            auto    auto 10/100BaseTX
Fa1/6                      notconnect   1            auto    auto 10/100BaseTX
Fa1/7                      notconnect   1            auto    auto 10/100BaseTX
Fa1/8                      notconnect   1            auto    auto 10/100BaseTX
Fa1/9                      notconnect   1            auto    auto 10/100BaseTX
Fa1/10                     notconnect   1            auto    auto 10/100BaseTX
Fa1/11                     notconnect   1            auto    auto 10/100BaseTX
Fa1/12                     notconnect   1            auto    auto 10/100BaseTX
Fa1/13                     notconnect   1            auto    auto 10/100BaseTX
Fa1/14                     connected    trunk      a-full   a-100 10/100BaseTX
Fa1/15                     connected    trunk      a-full   a-100 10/100BaseTX

STPの状態を確認します。

sw01#show spanning-tree summary
Root bridge for: VLAN1, VLAN10, VLAN11.
PortFast BPDU Guard is disabled
UplinkFast is disabled
BackboneFast is disabled

Name                 Blocking Listening Learning Forwarding STP Active
-------------------- -------- --------- -------- ---------- ----------
VLAN1                0        0         0        4          4
VLAN10               0        0         0        2          2
VLAN11               0        0         0        2          2
-------------------- -------- --------- -------- ---------- ----------
             3 VLANs 0        0         0        8          8

sw01#show spanning-tree brief

VLAN1
  Spanning tree enabled protocol ieee
  Root ID    Priority    32768
             Address     c200.0347.0000
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32768
             Address     c200.0347.0000
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/0      128.41   128    19 FWD     0 32768 c200.0347.0000 128.41
FastEthernet1/4      128.45   128    19 FWD     0 32768 c200.0347.0000 128.45
FastEthernet1/14     128.55   128    19 FWD     0 32768 c200.0347.0000 128.55
FastEthernet1/15     128.56   128    19 FWD     0 32768 c200.0347.0000 128.56


VLAN10
  Spanning tree enabled protocol ieee
  Root ID    Priority    32768
             Address     c200.0347.0001
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32768
             Address     c200.0347.0001
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/14     128.55   128    19 FWD     0 32768 c200.0347.0001 128.55
FastEthernet1/15     128.56   128    19 FWD     0 32768 c200.0347.0001 128.56


VLAN11
  Spanning tree enabled protocol ieee
  Root ID    Priority    32768
             Address     c200.0347.0002
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32768
             Address     c200.0347.0002
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/14     128.55   128    19 FWD     0 32768 c200.0347.0002 128.55
FastEthernet1/15     128.56   128    19 FWD     0 32768 c200.0347.0002 128.56

sw02でも同様に確認します。

sw02#show int trunk

Port      Mode         Encapsulation  Status        Native vlan
Fa1/14    on           802.1q         trunking      1
Fa1/15    on           802.1q         trunking      1

Port      Vlans allowed on trunk
Fa1/14    1-4094
Fa1/15    1-4094

Port      Vlans allowed and active in management domain
Fa1/14    1,10-11
Fa1/15    1,10-11

Port      Vlans in spanning tree forwarding state and not pruned
Fa1/14    1
Fa1/15    none

sw02#show int status

Port    Name               Status       Vlan       Duplex Speed Type
Fa1/0                      connected    1          a-full   a-100 10/100BaseTX
Fa1/1                      notconnect   1            auto    auto 10/100BaseTX
Fa1/2                      notconnect   1            auto    auto 10/100BaseTX
Fa1/3                      notconnect   1            auto    auto 10/100BaseTX
Fa1/4                      connected    1          a-full   a-100 10/100BaseTX
Fa1/5                      notconnect   1            auto    auto 10/100BaseTX
Fa1/6                      notconnect   1            auto    auto 10/100BaseTX
Fa1/7                      notconnect   1            auto    auto 10/100BaseTX
Fa1/8                      notconnect   1            auto    auto 10/100BaseTX
Fa1/9                      notconnect   1            auto    auto 10/100BaseTX
Fa1/10                     notconnect   1            auto    auto 10/100BaseTX
Fa1/11                     notconnect   1            auto    auto 10/100BaseTX
Fa1/12                     notconnect   1            auto    auto 10/100BaseTX
Fa1/13                     notconnect   1            auto    auto 10/100BaseTX
Fa1/14                     connected    trunk      a-full   a-100 10/100BaseTX
Fa1/15                     connected    trunk      a-full   a-100 10/100BaseTX

STPの状態を確認します。

sw02#show spanning-tree summary
Root bridge for: none.
PortFast BPDU Guard is disabled
UplinkFast is disabled
BackboneFast is disabled

Name                 Blocking Listening Learning Forwarding STP Active
-------------------- -------- --------- -------- ---------- ----------
VLAN1                1        0         0        3          4
VLAN10               1        0         0        1          2
VLAN11               1        0         0        1          2
-------------------- -------- --------- -------- ---------- ----------
             3 VLANs 3        0         0        5          8


3つのVLANとも fa1/15 がブロッキングポートとなっています。

sw02#show spanning-tree brief

VLAN1
  Spanning tree enabled protocol ieee
  Root ID    Priority    32768
             Address     c200.0347.0000
             Cost        19
             Port        55 (FastEthernet1/14)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32768
             Address     c201.0347.0000
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/0      128.41   128    19 FWD    19 32768 c201.0347.0000 128.41
FastEthernet1/4      128.45   128    19 FWD    19 32768 c201.0347.0000 128.45
FastEthernet1/14     128.55   128    19 FWD     0 32768 c200.0347.0000 128.55
FastEthernet1/15     128.56   128    19 BLK     0 32768 c200.0347.0000 128.56


VLAN10
  Spanning tree enabled protocol ieee
  Root ID    Priority    32768
             Address     c200.0347.0001
             Cost        19
             Port        55 (FastEthernet1/14)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32768
             Address     c201.0347.0001
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/14     128.55   128    19 FWD     0 32768 c200.0347.0001 128.55
FastEthernet1/15     128.56   128    19 BLK     0 32768 c200.0347.0001 128.56


VLAN11
  Spanning tree enabled protocol ieee
  Root ID    Priority    32768
             Address     c200.0347.0002
             Cost        19
             Port        55 (FastEthernet1/14)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32768
             Address     c201.0347.0002
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/14     128.55   128    19 FWD     0 32768 c200.0347.0002 128.55
FastEthernet1/15     128.56   128    19 BLK     0 32768 c200.0347.0002 128.56

ブリッジのプライオリティを変更する。

ルートブリッジの選出においてはブリッジIDを比較して、値の小さいスイッチがルートブリッジに選出されます。
ブリッジIDは、ブリッジプライオリティ + MACアドレスで表されます。
ブリッジプライオリティを変更することで、ルートブリッジの選出に影響を与えることができます。

sw02

sw02 で vlan11 の ブリッジプライオリティを変更してみます。

sw02(config)#spanning-tree vlan 11 root primary

状態を確認します。

sw02#show spanning-tree summary
Root bridge for: VLAN11.
PortFast BPDU Guard is disabled
UplinkFast is disabled
BackboneFast is disabled

Name                 Blocking Listening Learning Forwarding STP Active
-------------------- -------- --------- -------- ---------- ----------
VLAN1                1        0         0        3          4
VLAN10               1        0         0        1          2
VLAN11               0        0         0        2          2
-------------------- -------- --------- -------- ---------- ----------
             3 VLANs 2        0         0        6          8

VLAN11のみ、こちらがルートブリッジになりました。
VLAN1、VLAN10 の fa1/15 がブロッキングとなっています。

sw02#show spanning-tree brief

VLAN1
  Spanning tree enabled protocol ieee
  Root ID    Priority    32768
             Address     c200.0347.0000
             Cost        19
             Port        55 (FastEthernet1/14)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32768
             Address     c201.0347.0000
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/0      128.41   128    19 FWD    19 32768 c201.0347.0000 128.41
FastEthernet1/4      128.45   128    19 FWD    19 32768 c201.0347.0000 128.45
FastEthernet1/14     128.55   128    19 FWD     0 32768 c200.0347.0000 128.55
FastEthernet1/15     128.56   128    19 BLK     0 32768 c200.0347.0000 128.56


VLAN10
  Spanning tree enabled protocol ieee
  Root ID    Priority    32768
             Address     c200.0347.0001
             Cost        19
             Port        55 (FastEthernet1/14)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32768
             Address     c201.0347.0001
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/14     128.55   128    19 FWD     0 32768 c200.0347.0001 128.55
FastEthernet1/15     128.56   128    19 BLK     0 32768 c200.0347.0001 128.56


VLAN11
  Spanning tree enabled protocol ieee
  Root ID    Priority    8192
             Address     c201.0347.0002
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    8192
             Address     c201.0347.0002
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/14     128.55   128    19 FWD     0  8192 c201.0347.0002 128.55
FastEthernet1/15     128.56   128    19 FWD     0  8192 c201.0347.0002 128.56

sw01 でも確認します。

sw01#show spanning-tree summary
Root bridge for: VLAN1, VLAN10.
PortFast BPDU Guard is disabled
UplinkFast is disabled
BackboneFast is disabled

Name                 Blocking Listening Learning Forwarding STP Active
-------------------- -------- --------- -------- ---------- ----------
VLAN1                0        0         0        4          4
VLAN10               0        0         0        2          2
VLAN11               1        0         0        1          2
-------------------- -------- --------- -------- ---------- ----------
             3 VLANs 1        0         0        7          8

VLAN1、VLAN10とも、引き続きこちらがルートブリッジです。
VLAN11 の fa1/15 がブロッキングとなっています。

sw01#show spanning-tree brief

VLAN1
  Spanning tree enabled protocol ieee
  Root ID    Priority    32768
             Address     c200.0347.0000
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32768
             Address     c200.0347.0000
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/0      128.41   128    19 FWD     0 32768 c200.0347.0000 128.41
FastEthernet1/4      128.45   128    19 FWD     0 32768 c200.0347.0000 128.45
FastEthernet1/14     128.55   128    19 FWD     0 32768 c200.0347.0000 128.55
FastEthernet1/15     128.56   128    19 FWD     0 32768 c200.0347.0000 128.56


VLAN10
  Spanning tree enabled protocol ieee
  Root ID    Priority    32768
             Address     c200.0347.0001
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32768
             Address     c200.0347.0001
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/14     128.55   128    19 FWD     0 32768 c200.0347.0001 128.55
FastEthernet1/15     128.56   128    19 FWD     0 32768 c200.0347.0001 128.56


VLAN11
  Spanning tree enabled protocol ieee
  Root ID    Priority    8192
             Address     c201.0347.0002
             Cost        19
             Port        55 (FastEthernet1/14)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32768
             Address     c200.0347.0002
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/14     128.55   128    19 FWD     0  8192 c201.0347.0002 128.55
FastEthernet1/15     128.56   128    19 BLK     0  8192 c201.0347.0002 128.56

ルートブリッジが変わっただけでは、ポートの負荷分散の役にはたちません。
確認したら設定を戻します。

sw02#conf t
sw02(config)#no spanning-tree vlan 11 root primary

ポートコストの変更

ルートポートの選出においては、送信されてくるBPDUのルートパスコスト、送信元ブリッジID、送信元ポートID の順で比較し、小さい値のポートがルートポートになります。
ポートコストを変更することで、ルートポートの選出に影響を与えることができます。

sw02

sw02 で vlan11 の fa1/14 のポートコストを悪化させます。

sw02(config)#int fa1/14
sw02(config-if)#spanning-tree vlan 11 cost 20

状態を確認します。
VLAN11の fa1/14 が ブロッキングに、fa1/15 がフォワーディングに変化しました。

sw02#show spanning-tree brief                                                                                                                                                                                                        [8/1510]

VLAN1
  Spanning tree enabled protocol ieee
  Root ID    Priority    32768
             Address     c200.0347.0000
             Cost        19
             Port        55 (FastEthernet1/14)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32768
             Address     c201.0347.0000
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/0      128.41   128    19 FWD    19 32768 c201.0347.0000 128.41
FastEthernet1/4      128.45   128    19 FWD    19 32768 c201.0347.0000 128.45
FastEthernet1/14     128.55   128    19 FWD     0 32768 c200.0347.0000 128.55
FastEthernet1/15     128.56   128    19 BLK     0 32768 c200.0347.0000 128.56


VLAN10
  Spanning tree enabled protocol ieee
  Root ID    Priority    32768
             Address     c200.0347.0001
             Cost        19
             Port        55 (FastEthernet1/14)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32768
             Address     c201.0347.0001
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/14     128.55   128    19 FWD     0 32768 c200.0347.0001 128.55
FastEthernet1/15     128.56   128    19 BLK     0 32768 c200.0347.0001 128.56


VLAN11
  Spanning tree enabled protocol ieee
  Root ID    Priority    32768
             Address     c200.0347.0002
             Cost        19
             Port        56 (FastEthernet1/15)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32768
             Address     c201.0347.0002
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/14     128.55   128    20 BLK     0 32768 c200.0347.0002 128.55
FastEthernet1/15     128.56   128    19 FWD     0 32768 c200.0347.0002 128.56


sw01

sw01 でも確認します。
こちらではポートの役割の変更はありません。

sw01#show spanning-tree brief

VLAN1
  Spanning tree enabled protocol ieee
  Root ID    Priority    32768
             Address     c200.0347.0000
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32768
             Address     c200.0347.0000
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/0      128.41   128    19 FWD     0 32768 c200.0347.0000 128.41
FastEthernet1/4      128.45   128    19 FWD     0 32768 c200.0347.0000 128.45
FastEthernet1/14     128.55   128    19 FWD     0 32768 c200.0347.0000 128.55
FastEthernet1/15     128.56   128    19 FWD     0 32768 c200.0347.0000 128.56


VLAN10
  Spanning tree enabled protocol ieee
  Root ID    Priority    32768
             Address     c200.0347.0001
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32768
             Address     c200.0347.0001
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/14     128.55   128    19 FWD     0 32768 c200.0347.0001 128.55
FastEthernet1/15     128.56   128    19 FWD     0 32768 c200.0347.0001 128.56


VLAN11
  Spanning tree enabled protocol ieee
  Root ID    Priority    32768
             Address     c200.0347.0002
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32768
             Address     c200.0347.0002
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/14     128.55   128    19 FWD     0 32768 c200.0347.0002 128.55
FastEthernet1/15     128.56   128    19 FWD     0 32768 c200.0347.0002 128.56

設定を元に戻します。

sw02(config)#int fa1/14
sw02(config-if)#no spanning-tree vlan 11 cost 20

ポートプライオリティの変更

送信元ポートIDは、ポートプライオリティ + ポート番号で表されます。
ポートプライオリティを変更することによっても、ルートポートの選出に影響を与えることができます。

sw01

sw01 で vlan11 の fa1/14 のポートプライオリティを変更して、優先度を下げてみます。

sw01(config-if)#int fa1/14
sw01(config-if)#spanning-tree vlan 11 port-priority 144

状態を確認します。
こちらではポートの役割の変更はありません。

sw01#show spanning-tree brief

VLAN1
  Spanning tree enabled protocol ieee
  Root ID    Priority    32768
             Address     c200.0347.0000
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32768
             Address     c200.0347.0000
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/0      128.41   128    19 FWD     0 32768 c200.0347.0000 128.41
FastEthernet1/4      128.45   128    19 FWD     0 32768 c200.0347.0000 128.45
FastEthernet1/14     128.55   128    19 FWD     0 32768 c200.0347.0000 128.55
FastEthernet1/15     128.56   128    19 FWD     0 32768 c200.0347.0000 128.56


VLAN10
  Spanning tree enabled protocol ieee
  Root ID    Priority    32768
             Address     c200.0347.0001
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32768
             Address     c200.0347.0001
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/14     128.55   128    19 FWD     0 32768 c200.0347.0001 128.55
FastEthernet1/15     128.56   128    19 FWD     0 32768 c200.0347.0001 128.56


VLAN11
  Spanning tree enabled protocol ieee
  Root ID    Priority    32768
             Address     c200.0347.0002
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32768
             Address     c200.0347.0002
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/14     144.55   144    19 FWD     0 32768 c200.0347.0002 144.55
FastEthernet1/15     128.56   128    19 FWD     0 32768 c200.0347.0002 128.56


sw02 でも確認します。
この場合でも、VLAN11の fa1/14 が ブロッキングに、fa1/15 がフォワーディングに変化しました。

sw02#show spanning-tree brief

VLAN1
  Spanning tree enabled protocol ieee
  Root ID    Priority    32768
             Address     c200.0347.0000
             Cost        19
             Port        55 (FastEthernet1/14)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32768
             Address     c201.0347.0000
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/0      128.41   128    19 FWD    19 32768 c201.0347.0000 128.41
FastEthernet1/4      128.45   128    19 FWD    19 32768 c201.0347.0000 128.45
FastEthernet1/14     128.55   128    19 FWD     0 32768 c200.0347.0000 128.55
FastEthernet1/15     128.56   128    19 BLK     0 32768 c200.0347.0000 128.56


VLAN10
  Spanning tree enabled protocol ieee
  Root ID    Priority    32768
             Address     c200.0347.0001
             Cost        19
             Port        55 (FastEthernet1/14)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32768
             Address     c201.0347.0001
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/14     128.55   128    19 FWD     0 32768 c200.0347.0001 128.55
FastEthernet1/15     128.56   128    19 BLK     0 32768 c200.0347.0001 128.56


VLAN11
  Spanning tree enabled protocol ieee
  Root ID    Priority    32768
             Address     c200.0347.0002
             Cost        19
             Port        56 (FastEthernet1/15)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32768
             Address     c201.0347.0002
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/14     128.55   128    19 BLK     0 32768 c200.0347.0002 144.55
FastEthernet1/15     128.56   128    19 FWD     0 32768 c200.0347.0002 128.56

確認したら設定を戻します。

sw01(config-if)#int fa1/14
sw01(config-if)#no spanning-tree vlan 11 port-priority 144

コンバージェンス高速化技術

https://www.infraexpert.com/study/stpz7.html

portfast

即時収束される。引き続きBPDUは送信される。
ブリッジが接続されないポート(PC等の端末が接続されるポート)で設定


(config-if)# spanning-tree portfast

uplinkfast

ルートポートにリンク障害があったときに、ルートポートの役割を5秒以内に非指定ポートに引き継がせる。
root, secondary root ではないスイッチで設定

(config)# spanning-tree uplinkfast

backbonefast

間接リンクに障害があったときのコンバージェンス時間(50秒:20⁺20⁺15)を20秒短縮する。
最大エージ待たずに、非指定ポートをリスニング状態へ移行。
全てのスイッチで設定

(config)# spanning-tree backbonefast

まとめ

Dynagen、Dynamips を使って、STP の、ルートブリッジ、ルートポートの変更を練習しました。
STPでは、自分でルートブリッジや、ルートポート、あるいは非指定ポートをコントロールできます。
dynamips で対応しているのは 基本的な STP のみで、RSTP等には対応していません。これらの検証には他の手段が必要となってきます。

GitHubで編集を提案

Discussion