Home » VLAN Deep Dive: 802.1Q Tagging, Native VLAN, Voice VLAN, Private VLAN, VLAN Pruning และ Best Practices
VLAN Deep Dive: 802.1Q Tagging, Native VLAN, Voice VLAN, Private VLAN, VLAN Pruning และ Best Practices
VLAN Deep Dive: 802.1Q Tagging, Native VLAN, Voice VLAN, Private VLAN, VLAN Pruning และ Best Practices
VLAN (Virtual LAN) แบ่ง physical network เป็น logical segments เพื่อ security, performance และ management 802.1Q Tagging เพิ่ม VLAN tag ใน Ethernet frame สำหรับ trunk links, Native VLAN คือ VLAN ที่ไม่ถูก tag บน trunk, Voice VLAN แยก traffic เสียงออกจาก data, Private VLAN ให้ isolation ภายใน VLAN เดียวกัน, VLAN Pruning ลด unnecessary broadcast traffic และ Best Practices ช่วยออกแบบ VLAN ที่ secure และ scalable
VLAN เป็น พื้นฐานที่สุดของ network segmentation แต่หลายองค์กรยังใช้ผิด: ใส่ทุกอย่างใน VLAN 1 (default), ไม่เปลี่ยน native VLAN บน trunk (VLAN hopping attack), ไม่ใช้ voice VLAN สำหรับ IP phones (QoS แย่), ไม่ prune VLANs (broadcast ท่วม) การเข้าใจ VLAN อย่างลึก ช่วยสร้าง network ที่ secure, performant และ manageable
802.1Q Tagging
| Feature |
รายละเอียด |
| คืออะไร |
IEEE standard ที่เพิ่ม 4-byte tag ใน Ethernet frame เพื่อระบุ VLAN membership |
| Tag Format |
TPID (0x8100, 2 bytes) + TCI: PCP (3 bits QoS) + DEI (1 bit) + VID (12 bits VLAN ID) |
| VLAN Range |
0-4095 (12 bits) — usable: 1-4094 (0 และ 4095 reserved) |
| Access Port |
เชื่อม end device — ไม่มี tag (switch เพิ่ม/ลบ tag เอง) |
| Trunk Port |
เชื่อม switch-to-switch — carry multiple VLANs ด้วย 802.1Q tags |
| Frame Size |
Standard Ethernet 1518 bytes + 4-byte tag = 1522 bytes (baby giant) |
Native VLAN
| Feature |
รายละเอียด |
| คืออะไร |
VLAN ที่ไม่ถูก tagged บน trunk link — frames ที่ไม่มี tag ถูกจัดเข้า native VLAN |
| Default |
VLAN 1 (ทุก Cisco switch) — ต้องเปลี่ยนเพื่อ security |
| Mismatch |
ถ้า native VLAN ไม่ตรงกัน 2 ฝั่งของ trunk → traffic leak ข้าม VLANs |
| VLAN Hopping |
Attacker ส่ง double-tagged frame → outer tag = native VLAN, inner tag = target VLAN → hop VLANs |
| Best Practice |
เปลี่ยน native VLAN เป็น unused VLAN (e.g., 999) + tag native VLAN บน trunk |
Voice VLAN
| Feature |
รายละเอียด |
| คืออะไร |
VLAN แยกสำหรับ IP phone traffic — แยก voice จาก data สำหรับ QoS |
| How |
Switch port: access VLAN (data) + voice VLAN → phone tags voice traffic ด้วย voice VLAN |
| CDP/LLDP |
Switch บอก phone ว่าใช้ voice VLAN อะไร ผ่าน CDP หรือ LLDP-MED |
| QoS |
Voice traffic ได้ DSCP EF (46) + priority queuing → low latency, no jitter |
| Security |
แยก voice traffic จาก data → attacker on data VLAN ไม่สามารถ sniff voice |
| Config |
switchport voice vlan [id] — เพิ่มบน access port ที่ต่อ IP phone |
Private VLAN (PVLAN)
| Type |
Can Communicate With |
Use Case |
| Promiscuous |
ทุก port (isolated + community + promiscuous) |
Default gateway, DHCP server, shared services |
| Isolated |
Promiscuous only (ไม่คุยกับ isolated/community อื่น) |
Individual hosts ที่ต้อง isolate (DMZ servers, hotel rooms) |
| Community |
Same community + Promiscuous (ไม่คุยกับ community อื่น/isolated) |
Group of hosts ที่ต้องคุยกัน (team servers) |
VTP (VLAN Trunking Protocol)
| Mode |
Description |
Risk |
| Server |
Create/modify/delete VLANs → propagate to clients |
อาจ overwrite VLANs ทั้ง network ถ้า revision number สูงกว่า |
| Client |
Receive VLAN info จาก server → ไม่สร้าง/ลบ VLANs ได้ |
VTP bomb: switch ที่มี higher revision → ลบ VLANs ทั้งหมด |
| Transparent |
ไม่ participate ใน VTP → forward VTP messages แต่ไม่ apply |
Safe — ไม่ถูก affect จาก VTP changes |
| Off (VTPv3) |
ไม่ forward VTP messages เลย |
Safest — completely isolated from VTP |
| Best Practice |
ใช้ VTP Transparent หรือ Off — manage VLANs locally per switch |
หลีกเลี่ยง VTP Server/Client ใน production |
VLAN Pruning
| Feature |
รายละเอียด |
| คืออะไร |
ลบ VLANs ที่ไม่จำเป็นออกจาก trunk → ลด broadcast/multicast/unknown unicast |
| Manual Pruning |
switchport trunk allowed vlan [list] — specify เฉพาะ VLANs ที่ต้องการ |
| VTP Pruning |
Automatic: VTP prune VLANs ที่ไม่มี active ports บน switch ปลายทาง |
| Default |
Trunk carry ALL VLANs (1-4094) → broadcast ทุก VLAN ไปทุก trunk = waste |
| Best Practice |
Manual prune เสมอ — only allow VLANs ที่ใช้จริงบนแต่ละ trunk |
VLAN Design Best Practices
| Practice |
Detail |
| Don’t Use VLAN 1 |
Move management traffic ออกจาก VLAN 1 — ใช้ dedicated management VLAN |
| Change Native VLAN |
เปลี่ยนจาก VLAN 1 เป็น unused VLAN (999) บนทุก trunk |
| Prune Trunks |
Only allow needed VLANs per trunk — ลด broadcast domain |
| Segment by Function |
Data VLAN, Voice VLAN, Management VLAN, Guest VLAN, IoT VLAN, Server VLAN |
| Limit VLAN Span |
VLAN ควรอยู่ภายใน access-distribution block — ไม่ stretch ข้าม campus |
| DHCP Snooping |
Enable บนทุก access VLAN — prevent rogue DHCP servers |
| Dynamic ARP Inspection |
Enable กับ DHCP snooping — prevent ARP spoofing attacks |
| Port Security |
Limit MAC addresses per port — prevent MAC flooding attacks |
ทิ้งท้าย: VLAN = Foundation of Network Segmentation
VLAN Deep Dive 802.1Q: 4-byte tag (TPID + PCP + DEI + VID 12-bit), access ports (untagged), trunk ports (tagged) Native VLAN: untagged on trunk (default VLAN 1), change to unused VLAN, prevent VLAN hopping Voice VLAN: separate voice/data, CDP/LLDP discovery, QoS (DSCP EF), security isolation PVLAN: promiscuous (talk to all), isolated (talk to promiscuous only), community (talk to same group) VTP: server/client risky (VTP bomb), use transparent/off, manage VLANs locally Pruning: manual (allowed vlan list) or VTP auto, reduce broadcast traffic on trunks Best Practices: no VLAN 1, change native, prune trunks, segment by function, DHCP snooping, DAI, port security Key: VLANs are simple concept but implementation details matter — secure trunks, prune properly, isolate with PVLANs
อ่านเพิ่มเติมเกี่ยวกับ STP RSTP MSTP Spanning Tree Loop Prevention และ Network Security Architecture Defense in Depth ที่ siamlancard.com หรือจาก icafeforex.com และ siam2r.com