STP/RSTP/MSTP: Spanning Tree Protocol, Root Bridge, Port Roles, BPDU Guard และ Loop Prevention

STP/RSTP/MSTP: Spanning Tree Protocol, Root Bridge, Port Roles, BPDU Guard และ Loop Prevention

STP (Spanning Tree Protocol) ป้องกัน Layer 2 loops ใน switched networks Root Bridge เป็น switch หลักที่กำหนด topology, Port Roles (Root, Designated, Blocking) กำหนดการ forward/block ของแต่ละ port, RSTP ปรับปรุง convergence จาก 30-50 วินาทีเหลือ 1-2 วินาที, MSTP จัดกลุ่ม VLANs เข้า instances เพื่อ optimize และ BPDU Guard ป้องกัน rogue switches

L2 loops เป็น ปัญหาร้ายแรงที่สุดใน switched networks: broadcast storm จาก single loop สามารถ bring down ทั้ง network ใน seconds เพราะ frames ไม่มี TTL เหมือน IP packets → วนไปเรื่อยๆ → CPU 100% บนทุก switch → network ล่มทั้งหมด STP ป้องกันโดย block redundant paths แต่ยัง forward ได้เมื่อ primary path fail

STP (802.1D) Basics

Concept Description
Root Bridge Switch ที่มี lowest Bridge ID (priority + MAC) — center of STP topology
Bridge ID Priority (default 32768) + System ID Extension (VLAN) + MAC address
BPDU Bridge Protocol Data Unit — messages ที่ switches แลกเปลี่ยนเพื่อ elect root + determine topology
Path Cost Cost ของ link ตาม bandwidth: 10G=2, 1G=4, 100M=19, 10M=100
Root Path Cost Total cost จาก switch ไป Root Bridge (sum of link costs)
Convergence 30-50 seconds (Listening 15s → Learning 15s → Forwarding)

STP Port Roles

Role Description State
Root Port Best path ไป Root Bridge (lowest root path cost) — 1 per non-root switch Forwarding
Designated Port Best port on each segment ที่ forward traffic toward root — 1 per segment Forwarding
Blocking (Alternate) Redundant port ที่ถูก block เพื่อป้องกัน loop Blocking (ไม่ forward)
Disabled Administratively shut down Disabled

STP Port States

State BPDU MAC Learning Forwarding Duration
Blocking Receive only No No 20s (max age)
Listening Send + Receive No No 15s (forward delay)
Learning Send + Receive Yes No 15s (forward delay)
Forwarding Send + Receive Yes Yes Stable state
Disabled None No No Admin shutdown

RSTP (802.1w) — Rapid Spanning Tree

Feature STP (802.1D) RSTP (802.1w)
Convergence 30-50 seconds 1-2 seconds (sub-second possible)
Port Roles Root, Designated, Blocking Root, Designated, Alternate, Backup
Port States 5 states (Blocking, Listening, Learning, Forwarding, Disabled) 3 states (Discarding, Learning, Forwarding)
Proposal/Agreement ไม่มี (ต้องรอ timers) Rapid transition ด้วย proposal/agreement handshake
Edge Port PortFast (Cisco proprietary) Edge port (standard) — immediate forwarding
Topology Change TC notification ไป root → root propagates Direct TC notification to all switches (faster)

MSTP (802.1s) — Multiple Spanning Tree

Feature รายละเอียด
คืออะไร Map multiple VLANs to STP instances → reduce number of STP calculations
vs PVST+ PVST+: 1 STP instance per VLAN (100 VLANs = 100 instances) → resource heavy
MST Instance Group of VLANs sharing same STP topology (e.g., VLANs 1-50 → Instance 1, 51-100 → Instance 2)
IST (Instance 0) Internal Spanning Tree — default instance, interacts with other MST regions
MST Region Switches with same: region name + revision number + VLAN-to-instance mapping
Load Balancing Different root bridge per instance → traffic balanced across redundant links
Scalability 16 instances max (vs 4096 PVST+) — much more efficient

STP Security Features

Feature Purpose Action
BPDU Guard ป้องกัน rogue switch บน access ports Port receives BPDU → err-disable port immediately
BPDU Filter ไม่ส่งและไม่ receive BPDUs บน port Port ไม่ participate ใน STP (ระวัง — อาจสร้าง loop)
Root Guard ป้องกัน rogue switch จาก becoming root Port receives superior BPDU → root-inconsistent (blocking)
Loop Guard ป้องกัน loop เมื่อ BPDUs หยุด (unidirectional link failure) Port stops receiving BPDUs → loop-inconsistent (blocking)
PortFast Skip listening/learning states บน access ports Immediate forwarding (ใช้เฉพาะ access ports — never uplinks)
UDLD Detect unidirectional links (fiber miswiring) Err-disable port if unidirectional detected

STP Best Practices

Practice Detail
Set Root Bridge Manually set root bridge (lowest priority) — don’t rely on default MAC-based election
Use RSTP/MSTP Never use legacy STP (802.1D) — always RSTP or MSTP for fast convergence
PortFast + BPDU Guard Enable on ALL access ports (end devices) — prevents rogue switches + fast user access
Root Guard Enable on ports facing access layer — prevent access switches from becoming root
L3 at Distribution Route at distribution layer → limit STP domain to access-distribution block only
Minimize L2 Domain Smaller L2 domain = smaller STP domain = less risk of broadcast storms

ทิ้งท้าย: STP = Essential Loop Prevention, But Minimize Its Scope

STP/RSTP/MSTP STP (802.1D): root bridge election, port roles (root/designated/blocking), 30-50s convergence Port States: blocking → listening → learning → forwarding (STP) | discarding → learning → forwarding (RSTP) RSTP (802.1w): 1-2s convergence, proposal/agreement, alternate/backup ports, edge ports MSTP (802.1s): group VLANs into instances (max 16), MST regions, load balancing per instance Security: BPDU Guard (access ports), Root Guard (distribution), Loop Guard (redundant links), PortFast Best Practices: set root manually, use RSTP/MSTP, PortFast+BPDU Guard on access, L3 at distribution Key: STP is necessary evil in L2 networks — minimize L2 domain size and use modern alternatives (routed access, VXLAN)

อ่านเพิ่มเติมเกี่ยวกับ VXLAN EVPN Fabric BGP EVPN Data Center และ Network Design Patterns Spine-Leaf Campus ที่ siamlancard.com หรือจาก icafeforex.com และ siam2r.com

จัดส่งรวดเร็วส่งด่วนทั่วประเทศ
รับประกันสินค้าเคลมง่าย มีใบรับประกัน
ผ่อนชำระได้บัตรเครดิต 0% สูงสุด 10 เดือน
สะสมแต้ม รับส่วนลดส่วนลดและคะแนนสะสม

© 2026 SiamLancard — จำหน่ายการ์ดแลน อุปกรณ์ Server และเครื่องพิมพ์ใบเสร็จ

SiamLancard
Logo
Free Forex EA Download — XM Signal · EA Forex ฟรี
iCafeForex.com - สอนเทรด Forex | SiamCafe.net
Shopping cart