Spanning Tree Protocol: STP, RSTP, MSTP และ Loop Prevention

Spanning Tree Protocol: STP, RSTP, MSTP และ Loop Prevention

Spanning Tree Protocol (STP) ป้องกัน Layer 2 loops ใน switched networks โดยสร้าง loop-free logical topology จาก physical topology ที่มี redundant links STP (802.1D) เป็น original version ที่ converge ช้า (30-50 วินาที) RSTP (802.1w) converge เร็วกว่า (~1-2 วินาที) และ MSTP (802.1s) รองรับ multiple VLANs ใน spanning tree instances ที่ต่างกัน

Layer 2 loop เป็น ปัญหาร้ายแรงที่สุดใน switched network — broadcast storm ทำให้ network ล่มทั้งหมดภายในวินาที เพราะ frames ถูก replicate ไม่สิ้นสุด CPU utilization ของ switches พุ่ง 100% MAC address table unstable STP ป้องกันปัญหานี้โดย block redundant ports แต่ยังคง redundant paths สำหรับ failover

Layer 2 Loop Problem

Problem สาเหตุ ผลกระทบ
Broadcast Storm Broadcast frames วน loop ไม่สิ้นสุด Bandwidth เต็ม 100%, network ล่ม
MAC Table Instability MAC address เรียนรู้จากหลาย ports Unicast flooding, switch confused
Duplicate Frames Same frame ถูก deliver หลายครั้ง Application errors, data corruption

STP (802.1D) Basics

Concept รายละเอียด
Root Bridge Switch ที่มี lowest Bridge ID (priority + MAC) เป็น center ของ tree
Root Port (RP) Port บน non-root switch ที่ใกล้ Root Bridge ที่สุด (best path)
Designated Port (DP) Port ที่ forward traffic บนแต่ละ segment (best port per segment)
Blocked Port Port ที่ถูก block เพื่อป้องกัน loop (ไม่ forward data)
BPDU Bridge Protocol Data Unit — messages ที่ switches ส่งหากัน
Bridge ID Priority (default 32768) + MAC address
Path Cost Cost ของ link (10G=2, 1G=4, 100M=19, 10M=100)

STP Port States (802.1D)

State Learn MAC? Forward Data? Duration
Blocking No No 20 sec (max age)
Listening No No 15 sec (forward delay)
Learning Yes No 15 sec (forward delay)
Forwarding Yes Yes Stable state
Disabled No No Admin disabled

STP Convergence Time

Event Time
Max Age (BPDU timeout) 20 seconds
Forward Delay (Listening) 15 seconds
Forward Delay (Learning) 15 seconds
Total Convergence 30-50 seconds (unacceptable for modern networks)

RSTP (802.1w) — Rapid Spanning Tree

Feature STP (802.1D) RSTP (802.1w)
Convergence 30-50 seconds 1-2 seconds
Port States 5 (Blocking, Listening, Learning, Forwarding, Disabled) 3 (Discarding, Learning, Forwarding)
Port Roles Root, Designated, Blocked Root, Designated, Alternate, Backup
BPDU Processing Only Root Bridge generates BPDUs All switches generate BPDUs
Proposal/Agreement ไม่มี Rapid convergence mechanism
Edge Port PortFast (Cisco) Edge port (immediate forwarding)
Backward Compatible Yes (fallback to STP)

RSTP Port Roles

Role ความหมาย
Root Port Best path to Root Bridge (เหมือน STP)
Designated Port Best port per segment (เหมือน STP)
Alternate Port Backup path to Root Bridge (ready to become Root Port)
Backup Port Backup for Designated Port on same segment (rare)

MSTP (802.1s) — Multiple Spanning Tree

Feature รายละเอียด
คืออะไร Map multiple VLANs เข้า spanning tree instances (ลดจำนวน STP instances)
MST Instance กลุ่มของ VLANs ที่ share spanning tree topology เดียวกัน
MST Region กลุ่มของ switches ที่มี MST config เหมือนกัน (name, revision, VLAN-to-instance mapping)
IST (Instance 0) Internal Spanning Tree — default instance สำหรับ VLANs ที่ไม่ถูก map
ข้อดี ลด CPU/memory (ไม่ต้อง run STP per VLAN), load balance VLANs across instances

PVST+ vs RSTP vs MSTP

Feature PVST+ (Cisco) RSTP (802.1w) MSTP (802.1s)
STP Instance 1 per VLAN 1 for all VLANs 1 per instance (group of VLANs)
Load Balancing Per VLAN (different root per VLAN) ไม่มี (single tree) Per instance (group of VLANs)
Scalability ไม่ดี (100 VLANs = 100 instances) ดี (1 instance) ดีมาก (few instances for many VLANs)
CPU Usage สูง (per VLAN processing) ต่ำ ต่ำ
Standard Cisco proprietary IEEE 802.1w IEEE 802.1s

STP Protection Features

Feature ป้องกันอะไร วิธีทำงาน
PortFast / Edge Port Slow convergence บน access ports Skip Listening/Learning → immediate Forwarding
BPDU Guard Rogue switch บน access port Shutdown port ถ้าได้รับ BPDU (ใช้กับ PortFast ports)
Root Guard Unauthorized Root Bridge Block port ที่ได้รับ superior BPDU (ป้องกัน Root Bridge change)
Loop Guard Unidirectional link failure ป้องกัน blocked port เปลี่ยนเป็น forwarding เมื่อหยุดได้รับ BPDUs
BPDU Filter BPDU sending on edge ports ไม่ส่ง/รับ BPDU บน port (use carefully)
Storm Control Broadcast/multicast storms Limit broadcast/multicast traffic % per port

Best Practices

Practice รายละเอียด
ใช้ RSTP หรือ MSTP อย่าใช้ STP (802.1D) — convergence ช้าเกินไป
กำหนด Root Bridge Set priority lowest บน core switch (อย่าปล่อยให้ elect เอง)
PortFast + BPDU Guard ทุก access port ควรเปิด PortFast + BPDU Guard
Root Guard บน edge ป้องกัน rogue switch become Root Bridge
Document topology วาด STP topology + root bridge + blocked ports
Monitor Monitor STP topology changes (TCN) → alert เมื่อ topology change

ทิ้งท้าย: STP = Loop-Free Layer 2

Spanning Tree ป้องกัน L2 loops ด้วย Root Bridge + Root/Designated/Blocked ports STP (802.1D) = 30-50 sec convergence (legacy) RSTP (802.1w) = 1-2 sec convergence (recommended) MSTP (802.1s) = multiple VLANs per instance (scalable) PortFast + BPDU Guard บนทุก access port = best practice กำหนด Root Bridge อย่างชัดเจน (ไม่ปล่อยให้ elect เอง)

อ่านเพิ่มเติมเกี่ยวกับ EVPN-VXLAN และ Data Center Network Design ที่ 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