ความแตกต่างหลัก: Layer 2 vs Layer 3 Switch
| คุณสมบัติ | Layer 2 Switch | Layer 3 Switch |
| OSI Layer | Data Link (Layer 2) | Network (Layer 3) + Layer 2 |
| Forwarding Basis | MAC Address Table | MAC Table + IP Routing Table |
| Routing | ไม่ได้ (ต้องใช้ Router ภายนอก) | ได้ (Static, Dynamic: OSPF, EIGRP, BGP, RIP) |
| VLAN Routing (Inter-VLAN) | ไม่ได้ (Router-on-a-Stick) | ได้โดยตรง (SVI - Switch Virtual Interface) |
| Performance | Wire Speed Switching | Wire Speed Routing (ASIC) |
| Cost | ถูกกว่า | แพงกว่า |
| Use Case | Access Layer (End Devices) | Distribution/Core Layer, Collapsed Core |
Layer 2 Switch ใช้ทำอะไร?
- เชื่อม End Devices (PC, Printer, AP, IP Phone) ที่ Access Layer
- แบ่ง Collision Domain (แต่ละ Port = 1 Collision Domain)
- VLAN Segmentation (Logical Separation)
- Port Security, 802.1X, DHCP Snooping, Dynamic ARP Inspection (DAI)
Layer 3 Switch ใช้ทำอะไร?
- Inter-VLAN Routing (Gateway สำหรับ VLANs) - เร็วกว่า Router-on-a-Stick มาก
- Routing Protocols (OSPF, EIGRP) ภายใน LAN/Campus
- Policy-based Routing (PBR), VRF Lite (Multi-tenancy)
- Distribution/Core Layer ใน Hierarchical Design (Core, Distribution, Access)
- DHCP Relay, VRRP/HSRP (Gateway Redundancy)
Security Features บน Switch (ทั้ง L2 และ L3)
| Feature | Layer 2 | Layer 3 |
| Port Security (MAC Limit, Sticky MAC) | ✅ | ✅ |
| 802.1X Authentication (RADIUS) | ✅ | ✅ |
| DHCP Snooping / DAI / IP Source Guard | ✅ | ✅ |
| Private VLAN (Port Isolation) | ✅ | ✅ |
| ACL (Access Control List) | Port ACL (L2/L3/L4) | Port ACL + Router ACL (SVI) + VLAN ACL (VACL) |
| NetFlow / sFlow Export | บางรุ่น | ✅ (Full) |
| Control Plane Policing (CoPP) | ❌ | ✅ |
แนะนำสำหรับ Office Network (Enterprise)
- Access Layer: Layer 2 Switch (PoE+ สำหรับ AP/Phone) พร้อม Port Security, 802.1X, DHCP Snooping
- Distribution Layer: Layer 3 Switch (Stack/Wise Stack) ทำ Inter-VLAN Routing, ACL, Routing Protocols, Redundancy (VRRP/HSRP)
- Core Layer (ถ้ามี): Layer 3 Switch High-throughput, Low Latency, Redundancy
- Small Office (Collapsed Core): Layer 3 Switch เดียว/คู่ ทำทุกอย่าง (Access + Distribution + Core)
Layer 1 Switch (Physical Layer Switch) คืออะไร?
ทำงานที่ Physical Layer (Cabling, Optics) ไม่ได้อ่าน Header ใช้ใน Lab/Test/High-Frequency Trading สำหรับ Office Network ไม่จำเป็น
สรุป: เลือกแบบไหน?
- ต้องการแค่เชื่อม Device, VLAN, Port Security → Layer 2 Switch (Access Layer)
- ต้องการ Routing ระหว่าง VLAN, Redundancy, ACL บน SVI, Scalability → Layer 3 Switch (Distribution/Core)
- Best Practice: Hierarchical Design ใช้ทั้งคู่ Layer 2 ที่ Access, Layer 3 ที่ Distribution/Core
- Budget จำกัด/Small Office: Layer 3 Switch แบบ Collapsed Core (ทำหน้าที่ทั้งสอง)
Security Hardening สำหรับ Switch
- Disable Unused Ports (Shutdown)
- Port Security: Max MAC, Violation Action (Shutdown/Restrict)
- 802.1X + RADIUS (ISE, ClearPass, FreeRADIUS)
- DHCP Snooping + DAI + IP Source Guard (ป้องกัน Rogue DHCP, ARP Spoofing)
- Private VLAN สำหรับ Isolate Ports (Guest, IoT, DMZ)
- ACL บน SVI (L3) ควบคุม Inter-VLAN Traffic (Least Privilege)
- Management Plane Hardening: SSH Only, SNMPv3, HTTPS, AAA, CoPP
- Firmware Update เป็นประจำ (Security Advisories)