Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> ระบบเครือข่าย >> ความปลอดภัยเครือข่าย

Layer 2 vs Layer 3 Switch: เลือกแบบไหนสำหรับ Network Security สำนักงาน?

ความแตกต่างหลัก: Layer 2 vs Layer 3 Switch

คุณสมบัติLayer 2 SwitchLayer 3 Switch
OSI LayerData Link (Layer 2)Network (Layer 3) + Layer 2
Forwarding BasisMAC Address TableMAC Table + IP Routing Table
Routingไม่ได้ (ต้องใช้ Router ภายนอก)ได้ (Static, Dynamic: OSPF, EIGRP, BGP, RIP)
VLAN Routing (Inter-VLAN)ไม่ได้ (Router-on-a-Stick)ได้โดยตรง (SVI - Switch Virtual Interface)
PerformanceWire Speed SwitchingWire Speed Routing (ASIC)
Costถูกกว่าแพงกว่า
Use CaseAccess 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)

FeatureLayer 2Layer 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)

  1. Access Layer: Layer 2 Switch (PoE+ สำหรับ AP/Phone) พร้อม Port Security, 802.1X, DHCP Snooping
  2. Distribution Layer: Layer 3 Switch (Stack/Wise Stack) ทำ Inter-VLAN Routing, ACL, Routing Protocols, Redundancy (VRRP/HSRP)
  3. Core Layer (ถ้ามี): Layer 3 Switch High-throughput, Low Latency, Redundancy
  4. 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)