STP / RSTP / MSTP 仕様
35 / 35 items
InfraLab Reference Series
Category: STP / RSTP / MSTP
Updated: 2026-05-14
infralab.jp
stp-family
35 items
STP / RSTP / MSTP 仕様
Abstract
STP/RSTP/MSTP の BPDU、Bridge ID、ポート役割とステート、タイマー、トポロジ変更、Cisco 拡張、MST リージョン設定をまとめた L2 仕様集。
Table of Contents
1. 概要 (IEEE)
1.1. STP ファミリ
L2 ループを防ぎ、冗長リンクの一部をブロックしてツリー構造を作る制御プロトコル群。
IEEE 802.1D (STP), 802.1w (RSTP), 802.1s (MSTP)。現在は IEEE 802.1Q に統合1.2. Root Bridge
最小 Bridge ID を持つスイッチが Root Bridge になる。全ポートコスト計算の起点。
Bridge ID = Priority 4bit + System ID Extension 12bit + MAC 48bit。低い値が優先1.3. Bridge Priority
Root Bridge 選出を制御する値。VLAN ID を System ID Extension として含むため 4096 刻みで設定する。
Priority 有効値: 0,4096,...,61440。既定 32768 + VLAN ID1.4. パスコスト
Root Bridge までの累積コストで最短パスを選ぶ。古い短形式と新しい長形式がある。
短形式例: 10M=100, 100M=19, 1G=4, 10G=2, 100G=1。長形式は高速リンクでより細かく表現2. BPDU
2.1. Configuration BPDU
Root 情報、コスト、Bridge ID、Port ID、タイマーを伝える基本 BPDU。
Dst MAC 01:80:C2:00:00:00。LLC DSAP/SSAP 0x42。Protocol ID=0, Version, BPDU Type=0x00
IEEE 802.1D Configuration BPDU ASCII 図:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Protocol ID | Version | BPDU Type |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Flags | Root ID ... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Root ID ... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Root ID | Root Path Cost |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|Root Path Cost | Bridge ID ... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Bridge ID ... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Port ID | Message Age |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Max Age | Hello Time |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Forward Delay | Reserved |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+2.2. TCN BPDU
古典 STP の Topology Change Notification。非 root から root 方向に通知される。
BPDU Type=0x80。802.1D TCN。Root が TC bit 付き Configuration BPDU を配布
IEEE 802.1D Topology Change Notification BPDU ASCII 図:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Protocol ID | Version | BPDU Type |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+2.3. RSTP BPDU
RSTP では全スイッチが Hello ごとに BPDU を送信し、proposal/agreement で高速収束する。
Protocol Version ID=2、BPDU Type=0x02。Flags に Proposal, Agreement, Role, TC など
IEEE 802.1Q RST BPDU ASCII 図:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Protocol ID | Version | BPDU Type |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Flags | Root ID ... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Root ID ... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Root ID | Root Path Cost |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|Root Path Cost | Bridge ID ... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Bridge ID ... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Port ID | Message Age |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Max Age | Hello Time |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Forward Delay | Reserved |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+2.4. MSTP BPDU
MSTP は CIST と MSTI 情報を BPDU に含め、複数 VLAN をインスタンスへ束ねる。
MST Configuration Identifier: name, revision, VLAN-to-instance mapping digest。IEEE 802.1s/802.1Q
IEEE 802.1Q MST BPDU ASCII 図:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Protocol ID | Version | BPDU Type |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| CIST Flags | CIST Root ID ... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| CIST Root ID / Cost ... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| CIST Bridge ID / Port ID ... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Msg Age | Max Age |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Hello Time | Forward Delay |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Ver1 Len | Ver3 Len | MST Config |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| MST Config Identifier ... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| MSTI Configuration Messages ... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+2.5. Port ID
同一コスト時の比較に使うポート識別子。ポート priority とポート番号から成る。
Port ID = Port Priority 4bit + Port Number 12bit。低い値が優先3. ポート役割・ステート
3.1. STP Disabled
管理的に無効またはリンクダウンの状態。フレーム転送も学習も行わない。
802.1D state: Disabled3.2. STP Blocking
ループ防止のためユーザフレームを転送せず、MAC 学習もしない。BPDU は受信する。
Blocking。Forward Delay には含まれず Max Age まで情報保持3.3. STP Listening
転送前の中間状態。BPDU 処理は行うが MAC 学習とユーザフレーム転送はしない。
Listening: Forward Delay 15s 既定3.4. STP Learning
MAC 学習を開始するが、ユーザフレーム転送はまだ行わない。
Learning: Forward Delay 15s 既定3.5. STP Forwarding
通常転送状態。MAC 学習とユーザフレーム転送の両方を行う。
Blocking -> Listening 15s -> Learning 15s -> Forwarding。最大 50s 程度で収束3.6. RSTP Root Port
非 root bridge が Root Bridge へ向かう最良ポート。各 bridge に通常 1 つ。
Role=Root。State は通常 Forwarding3.7. RSTP Designated Port
セグメント上で root 方向の最良情報を広告するポート。代表として転送する。
Role=Designated。Proposal/Agreement で高速 Forwarding3.8. RSTP Alternate / Backup
Alternate は root への代替経路、Backup は同一セグメントへの冗長ポート。通常 Discarding。
Alternate: root port の予備。Backup: designated port の予備3.9. RSTP ポートステート
RSTP は STP の Blocking/Listening/Disabled を Discarding に統合し、Learning と Forwarding を使う。
Discarding / Learning / Forwarding。エッジや P2P では数百 ms-数秒で収束4. タイマー
4.1. Hello Time
Root Bridge が Configuration BPDU を送る間隔。RSTP では各 bridge が Hello ごとに BPDU を送る。
Hello Time 既定 2s4.2. Forward Delay
STP の Listening と Learning 各状態で待つ時間。高速収束が必要なら RSTP を使う。
Forward Delay 既定 15s。Listening 15s + Learning 15s4.3. Max Age
受信 BPDU 情報を保持する時間。Root 情報が失効すると再計算が始まる。
Max Age 既定 20s4.4. Message Age
BPDU が Root からどれだけ経過して伝搬しているかを示す。Max Age 到達で破棄される。
Message Age は hop ごとに増加。Message Age >= Max Age で情報失効5. トポロジ変更
5.1. Topology Change
トポロジ変更時に MAC テーブルの ageing を短縮し、古い転送先によるブラックホールを避ける。
802.1D: TCN BPDU -> Root -> TC flag。CAM ageing time を Forward Delay へ短縮5.2. RSTP TC
RSTP では非エッジポートが Forwarding へ遷移したとき TC を拡散し、関連 MAC を flush する。
TC While timer 中 BPDU TC flag。Edge port の link up/down は TC 対象外5.3. CAM テーブル flush
トポロジ変更により MAC 学習情報を消す。過剰な TC は一時的な flooding 増加を起こす。
show spanning-tree detail で topology change count / last change を確認5.4. MSTP IST / MSTI
IST は MST リージョン全体の CIST 連携、MSTI は VLAN グループごとの独立したツリーを表す。
IST(instance 0) + MSTI(instance 1-4094)。VLAN-to-instance mapping6. Cisco 拡張
6.1. PVST+ / Rapid PVST+
Cisco の VLAN ごと STP 実装。Rapid PVST+ は VLAN ごとに RSTP 相当で収束する。
PVST+ は Cisco 独自。per-VLAN root tuning: spanning-tree vlan <id> root primary6.2. PortFast
エンドホスト接続ポートを即時 Forwarding にする。スイッチ接続ポートに誤設定するとループ危険がある。
spanning-tree portfast。RSTP Edge port 相当6.3. BPDU Guard
PortFast/Edge ポートで BPDU を受信したら errdisable し、誤接続スイッチによるループを防ぐ。
spanning-tree bpduguard enable。違反時 err-disabled6.4. Root Guard
指定ポートでより良い BPDU を受けた場合、Root Bridge 乗っ取りを防ぐため root-inconsistent にする。
spanning-tree guard root。Access/distribution 境界で利用6.5. Loop Guard
BPDU が一方向障害で途絶えたとき、ブロックポートが誤って Forwarding になるのを防ぐ。
spanning-tree guard loop。状態: loop-inconsistent6.6. UplinkFast / BackboneFast
古典 STP の収束改善 Cisco 拡張。RSTP 環境では機能が標準化され、通常は使わない。
UplinkFast: access uplink 代替を高速化。BackboneFast: indirect link failure を短縮7. 設定例
7.1. Cisco RSTP 設定例
Rapid PVST+ を有効化し、アクセス VLAN の root priority と edge 防御を設定する最小例。
spanning-tree mode rapid-pvst; spanning-tree vlan 10 root primary; interface Gi1/0/10; spanning-tree portfast; spanning-tree bpduguard enable7.2. Cisco MSTP 設定例
MST リージョン名、revision、VLAN と instance の対応を全スイッチで一致させる。
spanning-tree mode mst; spanning-tree mst configuration; name CAMPUS; revision 10; instance 1 vlan 10,20; instance 2 vlan 30,407.3. 確認コマンド
Root、ポート役割、TC 回数、guard 状態、MST digest を確認する。
show spanning-tree / show spanning-tree detail / show spanning-tree mst configuration / show interfaces status err-disabled8. References
- STP
- RSTP
- MSTP
- IEEE 802.1D
- IEEE 802.1w
- IEEE 802.1s
- IEEE 802.1Q
- BPDU
- Root Bridge
- Bridge ID
- PortFast
- BPDU Guard
- Root Guard
- Loop Guard
- PVST+
- Rapid PVST+
- MSTI
- IST
- Spanning Tree
- スパニングツリー