Spanning Tree Protocol หรือ STP ช่วยป้องกัน Layer 2 Loop ใน Ethernet Network แต่การเปิด STP เพียงอย่างเดียวยังไม่เพียงพอสำหรับ Production Network เพราะ Rogue Switch, BPDU ที่เข้ามาผิด Port, ความผิดพลาดในการต่อสาย หรือ Unidirectional Link สามารถทำให้ STP Topology เปลี่ยนผิดจากที่ออกแบบไว้ได้
Cisco จึงมี Security และ Protection Features หลายตัว เช่น BPDU Guard, Root Guard, BPDU Filter, Loop Guard และ UDLD แต่แต่ละ Feature แก้ปัญหาคนละประเภท และไม่ควรเปิดทุก Feature บนทุก Port โดยไม่เข้าใจหน้าที่ของมัน
บทความนี้จะอธิบายว่าแต่ละ Feature ป้องกันอะไร ควรใช้ตรงไหน พร้อม Cisco Lab, Verification Commands, Troubleshooting และแนวทางออกแบบ STP Security ที่สามารถนำไปใช้กับ Network จริงได้
สารบัญ
- STP Security คืออะไร?
- STP มีความเสี่ยงอะไรบ้าง?
- BPDU คืออะไร?
- PortFast เกี่ยวข้องกับ STP Security อย่างไร?
- BPDU Guard คืออะไร?
- Root Guard คืออะไร?
- BPDU Filter คืออะไร?
- Loop Guard คืออะไร?
- UDLD คืออะไร?
- เปรียบเทียบ STP Security Features
- ควรใช้ Feature ไหนตรงไหน?
- Cisco STP Security Lab
- Verification Commands
- Troubleshooting
- Production Design
- Best Practices
- FAQ
- บทสรุป
ภาค 1: ทำความเข้าใจ STP Security
STP Security คืออะไร?
STP Security คือการใช้ Protection Mechanism เพื่อควบคุมว่า Port ใดควรได้รับ BPDU, Switch ตัวใดสามารถมีอิทธิพลต่อ Root Bridge และ Link ใดควรถูก Block เมื่อเกิดความผิดปกติ
แนวคิดพื้นฐานคือ:
Normal Layer 2 Network
|
v
STP
|
v
Loop Prevention
|
+
|
STP Protection Features
|
v
More Predictable Topology
เป้าหมายไม่ใช่การแทนที่ STP แต่เป็นการสร้าง Guardrail รอบ STP เพื่อให้ Network ทำงาน ตาม Design ที่เรากำหนดไว้
STP มีความเสี่ยงอะไรบ้าง?
ตัวอย่าง Failure และ Security Scenario:
Rogue Switch
|
+---- Sends Superior BPDU
|
v
Unexpected Root Bridge
Wrong Cable
|
v
Unexpected Switch Connection
Unidirectional Link
|
v
STP Information Lost
|
v
Potential Loop
Incorrect PortFast Design
|
v
Layer 2 Instability
ดังนั้น Network Engineer ต้องรู้ว่า Port แต่ละประเภท ควรได้รับ BPDU หรือไม่ และควรตอบสนองอย่างไร เมื่อพบ BPDU ที่ไม่คาดคิด
ภาค 2: BPDU และ STP Control Traffic
BPDU คืออะไร?
BPDU หรือ Bridge Protocol Data Unit คือ Control Message ที่ Switch ใช้แลกเปลี่ยนข้อมูล สำหรับ Spanning Tree
BPDU ช่วยให้ Switch ตัดสินใจเกี่ยวกับ:
- Root Bridge
- Root Port
- Designated Port
- Path Cost
- STP Topology
ตัวอย่าง:
SW1
|
| BPDU
|
v
SW2
|
| BPDU
|
v
SW3
Superior BPDU คืออะไร?
โดยแนวคิดคือ BPDU ที่มีข้อมูล STP ดีกว่าเมื่อเทียบตาม STP Election Process และอาจทำให้ Switch เปลี่ยนการตัดสินใจ เกี่ยวกับ Root Bridge หรือ Path
ตัวอย่าง:
Designed Root
CORE1
|
|
ACCESS1
|
|
Rogue Switch
|
+---- Superior BPDU
|
v
STP Topology Changes
นี่เป็นหนึ่งในเหตุผลสำคัญ ที่ต้องมี Root Guard และ BPDU Guard ในตำแหน่งที่เหมาะสม
ภาค 3: PortFast กับ STP Security
PortFast คืออะไร?
PortFast เหมาะกับ Edge Port ที่เชื่อมต่อ End Device และไม่ควรมี Layer 2 Switch อยู่ด้านหลังตาม Network Design
Access Switch
|
| PortFast
v
PC
ตัวอย่าง Configuration:
interface GigabitEthernet1/0/10
switchport mode access
spanning-tree portfast
บน STP Mode และ Platform ที่รองรับ PortFast ช่วยให้ Edge Port เข้าสู่ Forwarding ได้รวดเร็วขึ้น โดยไม่ต้องรอขั้นตอนแบบ STP Port ปกติ
PortFast + BPDU Guard
คู่ที่พบได้บ่อยมากคือ:
Access Port
|
+---- PortFast
|
+---- BPDU Guard
PortFast ทำให้ Edge Port พร้อมใช้งานรวดเร็ว ส่วน BPDU Guard ช่วยป้องกันกรณี Port ดังกล่าว ได้รับ BPDU ทั้งที่ไม่ควรได้รับ
ภาค 4: BPDU Guard
BPDU Guard คืออะไร?
BPDU Guard ใช้ป้องกัน Edge Port ที่ตาม Design ไม่ควรได้รับ BPDU
สถานการณ์ปกติ:
Access Switch
|
| Access Port
|
v
PC
แต่ถ้ามีคนเปลี่ยนเป็น:
Access Switch
|
| Access Port
|
v
Rogue Switch
|
+---- BPDU
BPDU Guard สามารถตอบสนองต่อ BPDU ที่เข้ามาบน Port ที่ถูกป้องกัน โดยทำให้ Port ถูกปิดใช้งานตามกลไกของ Platform เพื่อป้องกันไม่ให้ Rogue Switch เข้ามามีผลต่อ STP Topology
Configure BPDU Guard แบบ Interface
ตัวอย่าง:
interface GigabitEthernet1/0/10
switchport mode access
spanning-tree portfast
spanning-tree bpduguard enable
Configure BPDU Guard แบบ Global
บน Cisco IOS/IOS XE หลาย Platform:
spanning-tree portfast edge bpduguard default
บาง Platform หรือ Release อาจใช้ Syntax เช่น:
spanning-tree portfast bpduguard default
เมื่อ BPDU Guard ทำงานเกิดอะไรขึ้น?
แนวคิดทั่วไป:
Edge Port
|
Receives BPDU
|
v
BPDU Guard
|
v
Port Protection / Error-Disabled
|
v
Traffic Stops
บน Platform ที่ใช้ Errdisable Mechanism สามารถตรวจสอบได้ด้วยคำสั่งที่เกี่ยวข้อง เช่น:
show interfaces status err-disabled
show errdisable recovery
ภาค 5: Root Guard
Root Guard คืออะไร?
Root Guard ใช้บังคับ STP Design ไม่ให้ Root Bridge ปรากฏมาจากทิศทาง ที่ Network Engineer ไม่ต้องการ
ตัวอย่าง Design:
CORE1
Designed Root
|
+----+----+
| |
ACCESS1 ACCESS2
|
|
Downstream Switch
เราไม่ต้องการให้ Downstream Switch ส่ง Superior BPDU จนกลายเป็น Root Bridge
เมื่อ Root Guard พบ Superior BPDU
Downstream Port
|
Superior BPDU
|
v
Root Guard
|
v
Root-Inconsistent
|
X
Forwarding Blocked
เมื่อ Superior BPDU หายไป Port สามารถกลับมาทำงาน ตาม STP Process ได้ โดยไม่เหมือน BPDU Guard ที่มักสัมพันธ์กับ Errdisable บน Cisco Platform หลายรุ่น
Configure Root Guard
interface GigabitEthernet1/0/20
spanning-tree guard root
Root Guard เหมาะกับ Port แบบไหน?
เหมาะกับ Port ที่เชื่อมต่อ ไปยัง Downstream Switch ซึ่งเราอนุญาตให้แลก BPDU แต่ไม่ต้องการให้ Switch ฝั่งนั้น กลายเป็น Root
Distribution Switch
|
| Root Guard
|
v
Access Switch
ภาค 6: BPDU Filter
BPDU Filter คืออะไร?
BPDU Filter เกี่ยวข้องกับการควบคุมการส่งหรือรับ BPDU แต่พฤติกรรมของมันต้องเข้าใจให้ชัด เพราะการใช้ผิดสามารถทำให้ STP มองไม่เห็น Loop ได้
แนวคิดความเสี่ยง:
SW1
| \
| \
| \
SW2---SW3
Physical Loop
+
BPDU Suppression
=
STP May Lose Protection
BPDU Filter ไม่ใช่ BPDU Guard
BPDU Guard
=
Unexpected BPDU
→ Protect / Disable Port
BPDU Filter
=
Controls BPDU Processing
→ Potentially Dangerous if Misused
ตัวอย่าง Interface Configuration
บน Platform ที่รองรับ:
interface GigabitEthernet1/0/10
spanning-tree bpdufilter enable
Global PortFast BPDU Filter
Cisco บาง Platform มี Global Behavior ที่ผูก BPDU Filter กับ PortFast และมีพฤติกรรมแตกต่างจาก Interface-Level BPDU Filter
ดังนั้นไม่ควรสรุปว่า คำว่า BPDU Filter ทุกแบบ ทำงานเหมือนกัน
ภาค 7: Loop Guard
Loop Guard คืออะไร?
Loop Guard ช่วยป้องกัน Layer 2 Loop ที่อาจเกิดเมื่อ Port ซึ่งควรได้รับ BPDU หยุดได้รับ BPDU อย่างผิดปกติ
ตัวอย่าง:
SW1 ================= SW2
| |
| |
+======================+
Redundant Layer 2 Paths
ตามปกติ STP จะ Block บาง Path เพื่อป้องกัน Loop
แต่ถ้า BPDU หายไปผิดปกติ:
Blocked / Alternate Port
|
| BPDU Stops
v
Possible Transition
|
v
Forwarding
|
v
Potential Loop
Loop Guard ช่วยป้องกัน Port ที่ควรได้รับ BPDU จากการเปลี่ยนไป Forwarding เพียงเพราะ BPDU หายไป ในสถานการณ์ที่เข้าข่าย
Configure Loop Guard
ตัวอย่าง:
interface GigabitEthernet1/0/48
spanning-tree guard loop
Loop-Inconsistent State
เมื่อ Loop Guard ทำงาน:
BPDU Expected
|
X
BPDU Missing
|
v
Loop Guard
|
v
Loop-Inconsistent
|
X
Forwarding
เมื่อ BPDU กลับมา STP สามารถประเมินสถานะใหม่ และ Recover ตาม Process
Loop Guard เหมาะกับ Port แบบไหน?
เหมาะกับ Redundant Switch-to-Switch Link ที่มีโอกาสเป็น Root Port หรือ Alternate/Blocking Path ตาม STP Design
ภาค 8: UDLD
UDLD คืออะไร?
UDLD หรือ Unidirectional Link Detection เป็น Cisco Feature ที่ช่วยตรวจจับ Link ที่ Traffic สามารถเดินทางได้เพียงทิศทางเดียว ในสถานการณ์และ Interface Type ที่รองรับ
ปกติ:
SW1 <================> SW2
TX ----------------->
RX <-----------------
Unidirectional Failure:
SW1 -----------------> SW2
SW1 <------- X -------- SW2
Layer 1 อาจยังดูเหมือน Link Up ในบาง Failure Scenario แต่ Communication ไม่ได้ทำงานสมบูรณ์สองทิศทาง
ทำไม Unidirectional Link อันตรายต่อ STP?
เพราะ STP พึ่งพาการรับ BPDU เพื่อเข้าใจ Topology
BPDU Expected
|
X
Not Received
|
v
Incorrect STP Assumption
|
v
Potential Layer 2 Loop
UDLD Normal Mode
ใช้ตรวจจับความผิดปกติ และดำเนินการตาม Behavior ของ Mode และ Platform
UDLD Aggressive Mode
Aggressive Mode พยายามตรวจสอบ Link ซ้ำ และสามารถ Disable Port เมื่อยืนยัน Unidirectional Condition ตามกลไกของ Platform
ตัวอย่าง Global Configuration:
udld aggressive
หรือ Interface-Level บน Platform ที่รองรับ:
interface GigabitEthernet1/0/48
udld port aggressive
ภาค 9: เปรียบเทียบ STP Protection Features
BPDU Guard, Root Guard, BPDU Filter, Loop Guard และ UDLD ต่างกันอย่างไร?
| Feature | ป้องกันอะไร | ตำแหน่งที่พบบ่อย |
|---|---|---|
| BPDU Guard | BPDU บน Port ที่ไม่ควรได้รับ | Edge / Access Port |
| Root Guard | Downstream Switch พยายามมีอิทธิพลจนกลายเป็น Root | Downstream-facing Switch Link |
| BPDU Filter | ควบคุม BPDU Processing | เฉพาะ Design ที่เข้าใจผลกระทบชัดเจน |
| Loop Guard | BPDU หายบน Port ที่ควรได้รับ BPDU | Redundant Switch Link |
| UDLD | Unidirectional Link | Switch Link โดยเฉพาะ Link ที่รองรับและมีความสำคัญ |
จำแบบง่าย
BPDU Guard
=
"Port นี้ไม่ควรเห็น BPDU"
Root Guard
=
"Switch ทางนี้ห้ามเป็น Root"
BPDU Filter
=
"ควบคุม BPDU"
Use Carefully
Loop Guard
=
"Port นี้ควรได้รับ BPDU
แต่ BPDU หายไป"
UDLD
=
"Link ต้องสื่อสารได้สองทิศทาง"
ภาค 10: ควรใช้ Feature ไหนตรงไหน?
ตัวอย่าง Campus Network
+---------+
| CORE1 |
| ROOT |
+----+----+
|
======+======
| |
+----+----+ +----+----+
| DIST1 | | DIST2 |
+----+----+ +----+----+
| |
| |
+----+-----------+----+
| ACCESS1 |
+--+-------+-------+--+
| | |
PC Phone Printer
Edge Access Port
เช่น Port ต่อ PC:
PortFast
+
BPDU Guard
Distribution ลงไป Access Switch
ถ้า Design กำหนดว่า Access Layer ต้องไม่มีวันกลายเป็น Root:
Root Guard
Redundant Switch Path
Port ที่ควรรับ BPDU และอาจเป็น Alternate Path:
Loop Guard
Critical Inter-Switch Link
เมื่อ Platform และ Media รองรับ:
UDLD
+
STP Protection
แต่ Feature ต้องถูกเลือก ตาม Port Role จริง ไม่ใช่เปิดทุก Feature พร้อมกันทุก Interface
ภาค 11: Cisco STP Security Lab
Lab Topology
SW1
Designed Root
/ \
/ \
/ \
SW2==========SW3
| |
| |
PC1 PC2
SW2 Gi1/0/10 → PC1
SW3 Gi1/0/10 → PC2
Lab Goal
ต้องการ:
SW1
=
Root Bridge
PC Ports
=
PortFast + BPDU Guard
Downstream Root Protection
=
Root Guard where appropriate
Redundant STP Path
=
Loop Guard where appropriate
Critical Supported Links
=
UDLD
Step 1 — กำหนด Root Bridge ให้ชัดเจน
ตัวอย่าง VLAN 10:
SW1(config)# spanning-tree vlan 10 root primary
จากนั้นตรวจ:
SW1# show spanning-tree vlan 10
มองหา:
Root ID
Bridge ID
Port Role
Port State
Cost
Step 2 — Configure Edge Port
บน SW2:
interface GigabitEthernet1/0/10
description USER-PC
switchport mode access
switchport access vlan 10
spanning-tree portfast
spanning-tree bpduguard enable
Step 3 — ทดสอบ BPDU Guard
เริ่มต้นด้วย PC:
SW2
|
| Gi1/0/10
|
PC1
Expected:
Normal
จากนั้นใน Lab เปลี่ยนปลายทางเป็น Switch:
SW2
|
| BPDU Guard
|
Rogue / Test Switch
|
+---- BPDU
Expected Result บน Platform ที่ใช้ Errdisable:
BPDU Detected
|
v
Port Error-Disabled
ตรวจสอบ
show interfaces status err-disabled
show spanning-tree interface GigabitEthernet1/0/10 detail
อย่ารีบเปิด Port ก่อนแก้ Root Cause
ไม่ควรทำเพียง:
shutdown
no shutdown
โดยไม่ตรวจว่า ทำไม BPDU จึงเข้ามาบน User Port
ควรถามก่อน:
มีคนต่อ Switch เพิ่มหรือไม่?
ต่อสายผิดหรือไม่?
Port ถูกใช้งานผิด Purpose หรือไม่?
มี Bridge Device หรือไม่?
Step 4 — ทดสอบ Root Guard
สมมติ SW2 มี Port เชื่อมต่อ Test Switch ที่ต้องไม่กลายเป็น Root:
interface GigabitEthernet1/0/20
spanning-tree guard root
ถ้า Test Switch ส่ง Superior BPDU:
show spanning-tree inconsistentports
อาจพบ Port อยู่ใน:
Root-Inconsistent
จากนั้นตรวจ Root Bridge ว่ายังคงเป็น SW1 ตาม Design
Step 5 — Configure Loop Guard
บน Link ที่เหมาะสมตาม Design:
interface GigabitEthernet1/0/48
spanning-tree guard loop
ตรวจ:
show spanning-tree interface GigabitEthernet1/0/48 detail
show spanning-tree inconsistentports
Step 6 — Configure UDLD
บน Platform และ Interface ที่รองรับ:
interface GigabitEthernet1/0/48
udld port aggressive
ตรวจ:
show udld
show udld interface GigabitEthernet1/0/48
ภาค 12: Verification Commands ที่ Network Engineer ควรรู้
ตรวจ STP ทั้ง VLAN
show spanning-tree vlan 10
ตรวจ:
- Root Bridge คือใคร?
- Root Port อยู่ตรงไหน?
- Designated Port ถูกต้องหรือไม่?
- Alternate/Blocking Path อยู่ตรงไหน?
- Cost สมเหตุสมผลหรือไม่?
ตรวจ Interface แบบละเอียด
show spanning-tree interface GigabitEthernet1/0/48 detail
ตรวจ Inconsistent Port
show spanning-tree inconsistentports
คำสั่งนี้สำคัญมาก เมื่อตรวจ Root Guard หรือ Loop Guard
ตรวจ Errdisable
show interfaces status err-disabled
ตรวจสาเหตุ Errdisable
บน Platform ที่รองรับ:
show errdisable recovery
ตรวจ UDLD
show udld
ภาค 13: STP Security Troubleshooting
Troubleshooting Workflow
User / Link Problem
|
v
Physical Link
|
v
Interface Status
|
v
VLAN
|
v
STP Role / State
|
v
Inconsistent Port?
|
v
Errdisable?
|
v
BPDU Guard?
|
v
Root Guard?
|
v
Loop Guard?
|
v
UDLD?
|
v
Topology / Cabling Root Cause
Case 1 — User Port ขึ้น Errdisabled
ตรวจ:
show interfaces status err-disabled
ถ้าเกี่ยวกับ BPDU Guard อย่าเพิ่ง Recover Port จนกว่าจะตรวจสิ่งที่ต่ออยู่ปลายสาย
Root Cause ที่เป็นไปได้:
User connected a switch
IP phone / device bridging unexpectedly
Wrong patch cable
Unauthorized network device
Port purpose changed
Case 2 — Port เป็น Root-Inconsistent
ตรวจ:
show spanning-tree inconsistentports
show spanning-tree vlan 10
ถ้า Root Guard เป็นสาเหตุ ให้ค้นหาว่าทำไม Port จึงได้รับ Superior BPDU
Expected Root
=
CORE1
Actual Superior BPDU Source
=
?
อาจเกิดจาก:
- Switch ใหม่มี Priority ต่ำเกินไป
- Configuration ผิด
- เชื่อมต่อ Network ผิดตำแหน่ง
- มี Rogue Switch
Case 3 — Port เป็น Loop-Inconsistent
ตรวจ:
show spanning-tree inconsistentports
show spanning-tree interface GigabitEthernet1/0/48 detail
จากนั้นตรวจ:
BPDU Reception
Neighbor Switch
Physical Link
Optics
Fiber
UDLD
Interface Errors
Case 4 — Link Up แต่ Network ใช้งานผิดปกติ
อย่าหยุดตรวจเพียง:
Interface = up/up
เพราะ Physical Link Up ไม่ได้พิสูจน์ว่า Communication สมบูรณ์สองทิศทาง
ตรวจ:
show interfaces
show spanning-tree
show udld
Interface Counters
Optics / Transceiver
Remote Side
Case 5 — เปลี่ยน Switch แล้ว Port ถูก Block
อย่ารีบ Disable Root Guard หรือ BPDU Guard เพื่อให้ Network กลับมาใช้งาน
ควรตรวจ:
New Switch STP Priority
Root Bridge Design
Port Role
Trunk Configuration
VLAN List
BPDU Source
Topology Diagram
ภาค 14: Production STP Security Design
ตัวอย่าง Enterprise Campus
CORE1
STP Root
||
||
+======++======+
| |
DIST1 DIST2
|| ||
|| ||
+===++==============++===+
| |
ACCESS1 ACCESS2
/ | \ / | \
PC Phone AP PC Phone Printer
Access Edge Ports
PortFast
+
BPDU Guard
Downstream-Facing STP Boundary
Root Guard
when design requires
Root must never appear
from that direction
Redundant Layer 2 Infrastructure
Loop Guard
on appropriate STP roles / links
Critical Supported Links
UDLD
especially where
unidirectional failure
is a realistic risk
กำหนด Root Bridge เอง
ไม่ควรปล่อยให้ Root Bridge เกิดขึ้นโดยบังเอิญ จาก Default Bridge Priority
Primary Root
=
Designed Distribution / Core
Secondary Root
=
Designed Backup
ตัวอย่าง:
spanning-tree vlan 10,20,30 root primary
Backup Switch:
spanning-tree vlan 10,20,30 root secondary
root primary และ root secondary
เป็น Cisco Convenience Commands
สำหรับช่วยกำหนด Bridge Priority
ควรตรวจ Priority จริงด้วย
show spanning-tree
STP Security เป็นเพียงส่วนหนึ่งของ Layer 2 Security
Layer 2 Security
|
+---- PortFast
|
+---- BPDU Guard
|
+---- Root Guard
|
+---- Loop Guard
|
+---- UDLD
|
+---- DHCP Snooping
|
+---- Dynamic ARP Inspection
|
+---- IP Source Guard
|
+---- Port Security
|
+---- 802.1X
Feature เหล่านี้แก้ปัญหาคนละประเภท และควรถูกออกแบบร่วมกัน แทนการมองแยกเป็น Command แต่ละคำสั่ง
ภาค 15: STP Security Best Practices
1. กำหนด Root Bridge อย่างชัดเจน
อย่าปล่อย Root Election ให้ขึ้นอยู่กับ Default Configuration โดยไม่ตั้งใจ
2. ใช้ PortFast เฉพาะ Edge Port ที่เหมาะสม
ต้องรู้ว่าปลาย Port ควรเป็น End Device ไม่ใช่ Infrastructure Switch ตาม Design
3. ใช้ BPDU Guard กับ Edge Port
ช่วยป้องกัน Switch หรือ Bridge ที่ไม่ควรปรากฏบน User Access Port
4. ใช้ Root Guard ตาม Root Boundary
กำหนดว่าทิศทางใด ห้ามเป็นแหล่งของ Root Bridge
5. ใช้ Loop Guard ตาม STP Role
โดยเฉพาะ Link ที่ควรได้รับ BPDU และการหายไปของ BPDU อาจทำให้เกิด Loop
6. ใช้ BPDU Filter อย่างระมัดระวัง
ไม่ควรใช้เป็น Shortcut เพื่อแก้ปัญหา STP โดยไม่เข้าใจผลกระทบ
7. พิจารณา UDLD บน Critical Link
โดยเฉพาะเมื่อ Hardware, Media และ Platform รองรับ และ Unidirectional Failure เป็นความเสี่ยงของ Design
8. Document Port Role
ตัวอย่าง:
Gi1/0/1
=
Uplink to DIST1
Gi1/0/10
=
User Access
Gi1/0/20
=
Downstream Switch
Gi1/0/48
=
Redundant Infrastructure Link
เมื่อรู้ Port Role จะเลือก STP Protection Feature ได้แม่นยำขึ้น
9. Test Failure Scenario
อย่าตรวจเฉพาะตอน Network ปกติ
ควรทดสอบ:
Unexpected BPDU
Superior BPDU
Link Failure
Switch Failure
Redundant Path
Port Recovery
10. ตรวจ Syslog และ Monitoring
เหตุการณ์เช่น BPDU Guard, Root-Inconsistent, Loop-Inconsistent หรือ UDLD Failure ควรถูกตรวจพบโดย Operations Team ไม่ใช่รอจน User โทรมาแจ้ง
ภาค 16: Feature Decision Guide
ถ้าเป็น User Access Port
End Device?
|
Yes
|
v
PortFast
+
BPDU Guard
ถ้าเป็น Downstream Switch Link
Should downstream
ever become Root?
|
+--+--+
| |
No Yes
| |
v v
Root Do not use
Guard Root Guard blindly
ถ้าเป็น Redundant STP Link
Should this port
keep receiving BPDU?
|
Yes
|
v
Consider
Loop Guard
ถ้ากังวลเรื่อง Unidirectional Link
Platform / Media
supports UDLD?
|
Yes
|
v
Evaluate UDLD
Normal / Aggressive
ถ้าคิดจะใช้ BPDU Filter
Why do we need
to suppress BPDU?
|
v
Understand exact behavior?
|
+--+--+
| |
No Yes
| |
v v
Don't Validate
Use in Lab First
ภาค 17: คำถามที่พบบ่อย
BPDU Guard กับ Root Guard ต่างกันอย่างไร?
BPDU Guard เหมาะกับ Port ที่ไม่ควรได้รับ BPDU ส่วน Root Guard ใช้กับ Port ที่รับ BPDU ได้ แต่ไม่ต้องการให้ Root Bridge ปรากฏจากทิศทางนั้น
BPDU Guard ควรใช้กับ PortFast หรือไม่?
เป็น Combination ที่พบได้บ่อยมาก บน Edge Access Port เพราะ PortFast เหมาะกับ End Device และ BPDU Guard ช่วยตอบสนอง เมื่อ Port ดังกล่าวได้รับ BPDU ที่ไม่คาดคิด
Root Guard ทำให้ Port Errdisabled หรือไม่?
โดยทั่วไป Root Guard ทำให้ Port เข้าสู่ Root-Inconsistent State เมื่อได้รับ Superior BPDU และสามารถ Recover เมื่อเงื่อนไขดังกล่าวหายไป
Loop Guard ทำให้ Port อยู่สถานะอะไร?
เมื่อเข้าเงื่อนไข Port สามารถเข้าสู่ Loop-Inconsistent State เพื่อป้องกันการ Forward ที่อาจสร้าง Loop
BPDU Filter ปลอดภัยกว่าการปิด STP หรือไม่?
ไม่ควรมอง BPDU Filter เป็นวิธีง่าย ๆ สำหรับหลีกเลี่ยง STP เพราะการ Suppress BPDU ผิดตำแหน่งสามารถทำให้ STP ไม่สามารถป้องกัน Loop ได้ตามที่ออกแบบ
Loop Guard กับ UDLD เหมือนกันหรือไม่?
ไม่เหมือนกัน
Loop Guard
=
Protects STP behavior
when expected BPDU disappears
UDLD
=
Detects unidirectional
link conditions
ในบาง Network Design ทั้งสอง Feature สามารถเสริมกันได้ แต่ไม่ได้แทนที่กันโดยตรง
PortFast ปิด STP หรือไม่?
ไม่ PortFast เปลี่ยนพฤติกรรม ของ Edge Port เพื่อให้เข้าสู่ Forwarding ได้เร็วขึ้นตาม STP Mode ที่รองรับ แต่ไม่ได้หมายความว่า STP ถูกปิดจาก Interface นั้นทั้งหมด
ควรเปิด BPDU Guard ทุก Port หรือไม่?
ไม่ ควรเปิดบน Port ที่ตาม Design ไม่ควรได้รับ BPDU โดยเฉพาะ Edge Access Port ไม่ควรเปิดแบบสุ่มบน Switch-to-Switch Infrastructure Link
ควรเปิด Root Guard ทุก Uplink หรือไม่?
ไม่ ต้องดู Direction และ STP Design เพราะบาง Uplink จำเป็นต้องสามารถเป็น Root Port ได้ตาม Redundancy Design
ทำไม Protection Feature ทำให้ Network Down?
บางครั้ง Feature ไม่ได้เป็นต้นเหตุของปัญหา แต่กำลังป้องกัน Configuration หรือ Topology ที่ผิด
Port Blocked
|
v
Don't immediately
disable protection
|
v
Find Root Cause
บทสรุป
STP Security ไม่ใช่การเปิดทุก Guard Feature บนทุก Port แต่เป็นการเลือก Protection ให้ตรงกับ Port Role และ Network Design
จำหน้าที่หลักได้ดังนี้:
BPDU Guard
=
Edge Port
should not receive BPDU
Root Guard
=
Root must not appear
from this direction
BPDU Filter
=
Controls BPDU processing
Use with caution
Loop Guard
=
Expected BPDU disappeared
UDLD
=
Detect unidirectional link
สำหรับ Access Layer รูปแบบที่พบได้บ่อยคือ:
PC / Printer / End Device
|
v
PortFast
+
BPDU Guard
|
v
Access Switch
สำหรับ Infrastructure Link ต้องวิเคราะห์ STP Role ก่อนเลือก:
Downstream Boundary
|
+---- Root Guard
Redundant STP Path
|
+---- Loop Guard
Critical Supported Link
|
+---- UDLD
สิ่งสำคัญที่สุดคือ Network Engineer ต้องรู้ว่า Root Bridge ควรอยู่ที่ไหน, แต่ละ Port มี Role อะไร และเมื่อเกิด Failure Topology ควรเปลี่ยนไปอย่างไร
เมื่อควบคุม STP Infrastructure ได้แล้ว หัวข้อถัดไปคือการศึกษาการโจมตี Layer 2 ที่เกี่ยวข้องกับ VLAN และวิธี Hardening Switch เพื่อป้องกันไม่ให้ผู้โจมตี เข้าถึง VLAN ที่ไม่ได้รับอนุญาต
บทความถัดไป: VLAN Hopping และ Layer 2 Attacks: Switch Spoofing, Double Tagging และการป้องกันบน Cisco
Share your thoughts here
Join the conversation and share your perspective on this article.