Firewall: อุปกรณ์ควบคุมトラฟฟิกเข้า-ออกเครือข่าย (Network Traffic Control)
Firewall คือระบบความปลอดภัยเครือข่าย (Hardware, Software, หรือ Cloud Service) ที่ ตรวจสอบและควบคุมการไหลของแพ็กเก็ตข้อมูล (Network Traffic) ระหว่างโซนที่ไว้ใจได้ (Trusted/Internal) และโซนที่ไม่ไว้ใจ (Untrusted/External/Internet) ตาม Security Policies/Kernels ที่กำหนดไว้ล่วงหน้า
Firewall ทำงานอย่างไร? (Core Functions)
- Packet Inspection: ตรวจสอบ Header (L3/L4: IP, Port, Protocol) และ Payload (L7: App Data)
- Policy Enforcement: ตัดสินใจ Allow / Deny / Drop / Reject / Log / Alert ตาม Rule Base
- Stateful Inspection: จำสถานะ Connection (TCP Handshake, Session) ไม่ใช่แค่ดู Packet เดี่ยว (Stateless)
- Logging & Auditing: บันทึก Event (Allowed, Blocked, Suspicious) สำหรับ SIEM/Analysis
- NAT (Network Address Translation): ซ่อน Internal IP (Source NAT) / Publish Service (Destination NAT)
3 ประเภท Firewall หลัก (Generations)
| Generation | ประเภท | การทำงาน | ข้อดี/ข้อจำกัด |
| 1st Gen | Packet Filtering (Stateless) | ดู Header (Src/Dst IP, Port, Protocol) ตาม ACL/Rule ไม่จำ State | ⚡ เร็ว, 💰 ถูก / 🚫 ไม่เห็น Context, แตกง่าย (IP Spoof, Fragment) |
| 2nd Gen | Stateful Inspection | จำ State Table (TCP SYN/SYN-ACK/ACK, UDP Timeout) ตัดสินใจจาก Context | ✅ มาตรฐานปัจจุบัน, 🛡️ กัน Spoof/Fragment / 🚫 ไม่ดู Layer 7 |
| 3rd Gen | Application Layer / Proxy Firewall | Terminate Connection, Inspect Payload (HTTP, DNS, SMTP, FTP), Deep Packet Inspection (DPI) | 🛡️ ดู Layer 7, Block App Attacks / 🐢 ช้ากว่า, ต้อง Proxy ทุก Protocol |
| Next-Gen | NGFW (Next-Generation Firewall) | Stateful + App-ID (App Control), User-ID, IPS/IDS, SSL Decrypt, Threat Intel, Sandbox, Cloud Delivered | 🌟 ครบครัน, Context-Aware / 💰 แพง, Complex, ต้อง Subscription |
NGFW (Next-Generation Firewall) - ความสามารถสำคัญ
- App-ID (Application Identification): ระบุแอปพลิเคชัน (Facebook, BitTorrent, SSH, SQL, RDP) ไม่ใช่แค่ Port
- User-ID: Map IP ↔ User (AD/LDAP/SAML) → Policy Based on User/Group
- Content-ID: IPS (Signature/Anomaly), Anti-Virus, Anti-Spyware, URL Filtering, File Blocking, WildFire/Sandbox
- SSL/TLS Decryption (Inbound/Outbound): ถอดรหัส HTTPS เพื่อ Inspect Malware/Data Leak (Privacy/Legal Considerations)
- Threat Intelligence Feed: Auto-update IOC (IP, Domain, Hash, URL) จาก Cloud
- Automation/API/Integration: SOAR, SIEM, XDR, Terraform, Ansible
Firewall Deployment Architectures
| Architecture | คำอธิบาย | Use Case |
| Perimeter (Edge) | Internet ↔ Firewall ↔ DMZ ↔ Internal Firewall ↔ LAN | Traditional, On-prem DC |
| Distributed / Micro-segmentation | Firewall ต่อ Host/Workload (Host-based, VMware NSX, Cisco ACI, Illumio) | Zero Trust, Cloud, Container |
| Cloud / FWaaS | Firewall as a Service (Zscaler, Palo Alto Prisma, FortiGate Cloud, Check Point CloudGuard) | Remote User, Branch, SaaS, SASE |
| Internal Segmentation | Firewall ระหว่าง VLAN/Zone (IT, OT, Server, Guest, Mgmt) | Defense in Depth, Compliance |
Firewall Rules Best Practices
- Default Deny (Implicit Deny All): บล็อกทั้งหมด เปิดเฉพาะที่จำเป็น (Least Privilege)
- Top-Down Processing: Specific Rules บน, General Rules ล่าง
- Naming Convention:
FW_RULE____ (เช่น FW_RULE_IN_WEB_ALLOW_001)
- Documentation (Description/Comment): Requestor, Ticket, Business Justification, Review Date
- Regular Rule Review: Shadowed Rules, Unused Rules (No Hits 90 days), Expired Rules, Risky Rules (Any/Any/Allow)
- Change Management: Request → Risk Assessment → Approval → Implement → Verify → Document
Firewall vs อื่นๆ
| เทคโนโลยี | ความแตกต่างหลัก |
| Router ACL | Stateless, L3/L4 Only, No App Awareness, No Threat Prevention, Performance Oriented |
| WAF (Web App Firewall) | Layer 7 Only (HTTP/HTTPS), OWASP Top 10 Focus, ไม่ใช่ Network Firewall |
| IPS/IDS | Detection/Prevention Focus, ในระหว่าง Traffic Flow (Inline/TAP), ไม่ทำ NAT/Routing |
| Proxy | Terminate Connection, Forward แทน Client, Cache, Auth, Filter (Forward/Reverse) |
| UTM (Unified Threat Management) | All-in-one Box (Firewall + AV + IPS + VPN + Web Filter) - SMB Focus, NGFW = Enterprise Grade |
สรุป
Firewall = ประตูรักษาประตูเครือข่าย ควบคุม Traffic ตาม Policy จาก Stateless Packet Filter → Stateful Inspection → Application Proxy → NGFW (App-ID, User-ID, Content-ID, SSL Decrypt, Threat Intel) เลือก Architecture ให้ตรง Use Case (Perimeter, Distributed, Cloud/SASE, Internal) และจัดการ Rule Base ด้วย Best Practices (Default Deny, Documentation, Review, Change Mgmt)