

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
อ่านเพิ่มเติม: TradingView ใช้ฟรี | Smart Money Concept
อ่านเพิ่มเติม: ราคาทอง Gold Price | EA Semi-Auto ฟรี
อ่านเพิ่มเติม: โค้ด EA Forex ฟรี | Smart Money Concept
อ่านเพิ่มเติม: EA Forex ฟรี | ดาวน์โหลด EA ฟรี
อ่านเพิ่มเติม: เทรดทองคำ XAU/USD | XM Signal EA
อ่านเพิ่มเติม: เทรด Forex | Smart Money Concept
FAQ
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 เป็นหัวข้อสำคัญในวงการเทคโนโลยีที่ช่วยให้การทำงานมีประสิทธิภาพมากขึ้น ไม่ว่าจะเป็นด้าน IT, Network หรือ Server Management
ทำไมต้องเรียนรู้เรื่อง 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/RSTP/MSTP: Spanning Tree Protocol, Root Bridge, Port Roles, BPDU Guard และ Loop Prevention เหมาะกับผู้เริ่มต้นไหม?
ได้แน่นอนครับ บทความนี้เขียนให้เข้าใจง่าย เหมาะทั้งผู้เริ่มต้นและผู้มีประสบการณ์ มี step-by-step guide พร้อมตัวอย่างให้ทำตามได้ทันที
สิ่งที่คุณจะได้เรียนรู้จากบทความนี้
บทความ STP/RSTP/MSTP: Spanning Tree Protocol, Root Bridge, Port Roles, BPDU Guard และ Loop Prevention นี้ครอบคลุมทุกอย่างที่คุณต้องรู้ ตั้งแต่พื้นฐานไปจนถึงการนำไปใช้จริง เขียนจากประสบการณ์จริง ไม่ใช่แค่ทฤษฎี มีตัวอย่างและ step-by-step guide ให้ทำตามได้ทันที
ทำไม 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 เป็นหัวข้อที่กำลังได้รับความสนใจสูงมากในปี 2569 ทั้งจากมือใหม่และผู้เชี่ยวชาญ เพราะมีการเปลี่ยนแปลงและพัฒนาใหม่ๆ อยู่ตลอด การติดตามข้อมูลล่าสุดเป็นสิ่งสำคัญ
FAQ
STP/RSTP/MSTP: Spanning Tree Protocol, Root Bridge, Port Roles, BPDU Guard และ Loop Prevention คืออะไร?
อ่านรายละเอียดทั้งหมดในบทความนี้ ครอบคลุมตั้งแต่พื้นฐานไปจนถึงขั้นสูง
iCafeForex | SiamLanCard | Siam2R | XM Signal
สิ่งที่ควรรู้เพิ่มเติมเกี่ยวกับ 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 ยังมีมิติอื่นที่น่าสนใจ การศึกษาเพิ่มเติมจะช่วยให้เข้าใจภาพรวมได้ดีขึ้น แนะนำให้อ่านบทความที่เกี่ยวข้องเพิ่มเติมและฝึกปฏิบัติจริง
อ่านเพิ่มเติม: iCafeForex | XM Signal EA ฟรี | SiamLanCard | Siam2R
สิ่งที่ควรรู้เพิ่มเติมเกี่ยวกับ 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 ยังมีมิติอื่นที่น่าสนใจ การศึกษาเพิ่มเติมจะช่วยให้เข้าใจภาพรวมได้ดีขึ้น แนะนำให้อ่านบทความที่เกี่ยวข้องเพิ่มเติมและฝึกปฏิบัติจริง
อ่านเพิ่มเติม: iCafeForex | XM Signal EA ฟรี | SiamLanCard | Siam2R
สิ่งที่ควรรู้เพิ่มเติมเกี่ยวกับ 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 ยังมีมิติอื่นที่น่าสนใจ การศึกษาเพิ่มเติมจะช่วยให้เข้าใจภาพรวมได้ดีขึ้น แนะนำให้อ่านบทความที่เกี่ยวข้องเพิ่มเติมและฝึกปฏิบัติจริง
อ่านเพิ่มเติม: iCafeForex | XM Signal EA ฟรี | SiamLanCard | Siam2R
สิ่งที่ควรรู้เพิ่มเติมเกี่ยวกับ 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 ยังมีมิติอื่นที่น่าสนใจ การศึกษาเพิ่มเติมจะช่วยให้เข้าใจภาพรวมได้ดีขึ้น แนะนำให้อ่านบทความที่เกี่ยวข้องเพิ่มเติมและฝึกปฏิบัติจริง
อ่านเพิ่มเติม: iCafeForex | XM Signal EA ฟรี | SiamLanCard | Siam2R
สิ่งที่ควรรู้เพิ่มเติมเกี่ยวกับ 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 ยังมีมิติอื่นที่น่าสนใจ การศึกษาเพิ่มเติมจะช่วยให้เข้าใจภาพรวมได้ดีขึ้น แนะนำให้อ่านบทความที่เกี่ยวข้องเพิ่มเติมและฝึกปฏิบัติจริง
อ่านเพิ่มเติม: iCafeForex | XM Signal EA ฟรี | SiamLanCard | Siam2R