Home » STP Deep Dive: RSTP, MSTP, Loop Guard, BPDU Guard และ Best Practices
STP Deep Dive: RSTP, MSTP, Loop Guard, BPDU Guard และ Best Practices
STP Deep Dive: RSTP, MSTP, Loop Guard, BPDU Guard และ Best Practices
Spanning Tree Protocol (STP) ป้องกัน Layer 2 loops ใน switched networks โดยการ block redundant paths RSTP (Rapid STP, 802.1w) ปรับปรุง convergence จาก 30-50 วินาที เหลือ 1-2 วินาที, MSTP (Multiple STP, 802.1s) รองรับหลาย VLANs ใน STP instance เดียว ลด overhead และ Loop Guard, BPDU Guard เป็น protection mechanisms ที่ป้องกัน loops และ rogue switches
Layer 2 loops เป็น ปัญหาร้ายแรงที่สุดใน switched network: broadcast storm ทำให้ CPU ของทุก device สูง 100%, MAC address table ปั่น, network ล่มทั้ง segment ภายในวินาที STP ป้องกัน loops แต่ต้อง configure protection features อย่างถูกต้อง ไม่เช่นนั้น loop อาจเกิดจากมุมที่ STP ไม่ครอบคลุม
STP vs RSTP vs MSTP
| Feature |
STP (802.1D) |
RSTP (802.1w) |
MSTP (802.1s) |
| Convergence |
30-50 seconds |
1-2 seconds |
1-2 seconds |
| Port States |
5 (Disabled, Blocking, Listening, Learning, Forwarding) |
3 (Discarding, Learning, Forwarding) |
3 (same as RSTP) |
| VLAN Support |
1 instance for all VLANs |
1 instance for all VLANs |
Multiple instances (group VLANs) |
| Topology Change |
TCN BPDU → root → TC flag |
Direct notification (faster) |
Per-instance TC |
| Backward Compatible |
– |
Yes (falls back to STP) |
Yes (RSTP compatible) |
RSTP Port Roles
| Role |
Function |
STP Equivalent |
| Root Port |
Best path to Root Bridge (forwarding) |
Same |
| Designated Port |
Best port on segment toward Root (forwarding) |
Same |
| Alternate Port |
Backup path to Root (blocking → instant failover) |
Blocking port |
| Backup Port |
Backup designated port on same segment (blocking) |
Blocking port |
| Disabled Port |
Administratively disabled |
Same |
RSTP Fast Convergence
| Mechanism |
รายละเอียด |
| Proposal/Agreement |
Designated port proposes → downstream agrees → instant forwarding (no timers) |
| Edge Port |
Port connected to end device → instant forwarding (= PortFast) |
| Alternate Port |
Pre-computed backup → instant failover เมื่อ root port fails |
| Direct TC |
Topology change detected → flush MACs locally + notify neighbors (no root involvement) |
MSTP (Multiple Spanning Tree)
| Feature |
รายละเอียด |
| MST Region |
Group of switches ที่มี config เหมือนกัน (name, revision, VLAN-to-instance mapping) |
| IST (Internal Spanning Tree) |
Instance 0 — default instance ที่ interact กับ STP/RSTP ภายนอก region |
| MSTI (MST Instance) |
Instance 1-64 — แต่ละ instance มี own root bridge + topology |
| VLAN Mapping |
Map groups of VLANs to instances (e.g., VLAN 1-100 → Instance 1, VLAN 101-200 → Instance 2) |
| Advantage |
ลดจำนวน STP instances (PVST+ = 1 instance/VLAN = ไม่ scale) |
| Load Balancing |
Different root bridges per instance → different forwarding paths per VLAN group |
STP Protection Features
| Feature |
Purpose |
Action |
| BPDU Guard |
ป้องกัน rogue switches บน access ports |
ถ้าได้รับ BPDU → err-disable port ทันที |
| Root Guard |
ป้องกัน unauthorized root bridge election |
ถ้าได้รับ superior BPDU → put port in root-inconsistent state |
| Loop Guard |
ป้องกัน unidirectional link failures |
ถ้า BPDU หยุดมา → put port in loop-inconsistent (ไม่ forward) |
| BPDU Filter |
หยุดส่ง/รับ BPDUs บน port |
Port ไม่ participate ใน STP (อันตราย ถ้าใช้ผิด) |
| PortFast (Edge) |
Skip listening/learning → instant forwarding |
ใช้เฉพาะ access ports (end devices only) |
| UplinkFast |
Fast failover สำหรับ uplink (legacy STP) |
RSTP alternate port ทำหน้าที่เดียวกัน |
Where to Apply Protection
| Port Type |
Features to Enable |
| Access ports (end devices) |
PortFast + BPDU Guard (mandatory) |
| Trunk to distribution/core |
Root Guard (on ports that should never become root) |
| Redundant uplinks |
Loop Guard (detect unidirectional failures) |
| Ports to other networks |
Root Guard + BPDU Guard |
| Unused ports |
Shutdown (disable unused ports) |
STP Best Practices
| Practice |
รายละเอียด |
| Use RSTP/MSTP |
ไม่ใช้ legacy STP (802.1D) — convergence ช้าเกินไป |
| Set root bridge |
กำหนด root bridge explicitly (spanning-tree priority) — ไม่ปล่อยให้ elect เอง |
| Secondary root |
กำหนด backup root bridge (priority 8192 หรือ 4096) |
| PortFast + BPDU Guard |
ทุก access port ต้องมี PortFast + BPDU Guard |
| Root Guard on distribution |
Distribution ports toward access → Root Guard (ป้องกัน rogue root) |
| Loop Guard on trunks |
Trunk ports ที่เป็น non-designated → Loop Guard |
| MSTP for scale |
ถ้ามี > 50 VLANs → ใช้ MSTP แทน PVST+ (ลด CPU overhead) |
| Monitor STP |
Monitor topology changes → frequent TC = unstable network (investigate) |
ทิ้งท้าย: STP = Loop Prevention Foundation
STP Deep Dive RSTP: 1-2 second convergence (proposal/agreement, alternate port instant failover) MSTP: group VLANs into instances (reduce STP overhead, per-instance root bridge) BPDU Guard: access ports (err-disable if BPDU received → block rogue switches) Root Guard: prevent unauthorized root bridges (distribution toward access) Loop Guard: detect unidirectional link failures (prevent silent loops) Best practice: RSTP/MSTP + explicit root + PortFast/BPDU Guard on access + Root Guard + Loop Guard
อ่านเพิ่มเติมเกี่ยวกับ EVPN-VXLAN Fabric และ Network Redundancy HSRP VRRP GLBP ที่ siamlancard.com หรือจาก icafeforex.com และ siam2r.com