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

NetFlow คืออะไร? ประโยชน์ต่อ Network Security และการวิเคราะห์ทราฟฟิก

NetFlow คืออะไร?

NetFlow เป็น **โปรโตคอลของ Cisco** ที่พัฒนาขึ้นเพื่อ **เก็บสถิติและบันทึกข้อมูลการไหลของ IP Traffic (IP Flow Data)** ผ่าน Router/Switch ที่เปิดใช้งาน NetFlow ให้ข้อมูลระดับ Flow (ไม่ใช่ Packet ทุกตัว) ช่วยให้เห็น "ใคร คุยกับ ใคร ผ่าน Port ไหน ใช้ Bandwidth เท่าไหร่ นานแค่ไหน"

NetFlow ทำงานอย่างไร?

  1. Router/Switch ได้รับ Packet แรกของ Flow ใหม่
  2. สร้าง **Flow Record** ใน Cache (Source IP, Dest IP, Source Port, Dest Port, Protocol, ToS, Input/Output Interface, Packet/Byte Count, Timestamps)
  3. Packet ต่อไปของ Flow เดียวกัน -> อัปเดต Counters ใน Cache เดียวกัน
  4. Flow หมดอายุ (Timeout: Active/Inactive) -> **Export** ส่งไปยัง **NetFlow Collector**
  5. Collector รวบรวม, จัดเก็บ, วิเคราะห์, แสดงผล (Dashboard, Alert, Report)

ข้อมูลที่ NetFlow ให้มา (Flow Record Fields)

  • Source/Destination IP Address
  • Source/Destination Port (L4)
  • IP Protocol (TCP=6, UDP=17, ICMP=1, etc.)
  • Type of Service (ToS/DSCP)
  • Input/Output Interface (SNMP ifIndex)
  • Packet Count, Byte Count
  • Start Time, End Time (Flow Duration)
  • TCP Flags (Cumulative OR), Next Hop IP, AS Numbers (BGP), VLAN IDs

ประโยชน์ของ NetFlow ต่อ Network Security (Security Use Cases)

NetFlow vs Full Packet Capture (PCAP)

Use Caseคำอธิบาย
Anomaly Detectionตรวจจับการเปลี่ยนแปลงรูปแบบทราฟฟิกผิดปกติ (DDoS, Scanning, C2 Beaconing, Data Exfil)
Threat Huntingค้นหา IOCs: Suspicious IPs, Ports, Protocols, Geographic Anomalies, Tor/VPN Exit Nodes
Incident Responseสืบสวนเหตุการณ์: ใครทำอะไร เมื่อไหร่ ไปไหน ส่งข้อมูลเท่าไหร่ (Forensics)
Network Visibilityเห็น "Shadow IT", Unauthorized Services, Rogue Devices, Cloud/App Usage
Compliance/Auditหลักฐานการสื่อสารระหว่าง Segment, Data Flow Mapping (PCI-DSS, HIPAA)
Capacity Planningเข้าใจ Bandwidth Usage, Top Talkers, Application Mix สำหรับ Upgrade Planning
ด้านNetFlow (Flow Data)Full PCAP (Packet Capture)
Storageน้อยมาก (Metadata เท่านั้น)มหาศาล (Full Packets)
Retentionนาน (เดือน-ปี)สั้น (ชั่วโมง-วัน)
VisibilityFlow Level (Who, Where, How Much)Packet Level (Full Payload)
Encrypted Trafficเห็น Metadata (SNI ไม่ได้)เห็น Encrypted Payload (ยังอ่านไม่ได้)
Analysis Speedเร็วมาก (Aggregated)ช้า ต้อง Deep Inspection
Costต่ำสูงมาก (Storage, Compute)

**NetFlow = ความเร็ว, ความกว้าง, ราคาถูก | PCAP = ความลึก, Forensics, ราคาแพง**

NetFlow Versions และ Standards

  • NetFlow v5: คงที่ (Fixed) IPv4 Only - เก่า แต่ยังใช้กัน
  • NetFlow v9: Template-based, Extensible, รองรับ IPv6, MPLS, VLAN
  • IPFIX (RFC 7011): Standard ของ IETF ขยายจาก v9, Vendor-neutral
  • sFlow (Sampled Flow): Sampling-based, ไม่ใช่ Cisco Proprietary, ใช้ใน Switch มาก

เครื่องมือ NetFlow Collector/Analyzer ยอดนิยม

  • Open Source: ntopng, nProbe, ElastiFlow (ELK), GoFlow2, Flowmeter
  • Commercial: SolarWinds NTA, Plixer Scrutinizer, Kentik, Cisco Stealthwatch, ManageEngine NetFlow Analyzer, PRTG, SevOne
  • Cloud/SaaS: Kentik, Corelight, ExtraHop Reveal(x), AWS VPC Flow Logs, Google Cloud VPC Flow Logs, Azure NSG Flow Logs

NetFlow และ SIEM

NetFlow **ไม่ใช่ SIEM** แต่เป็น **Data Source สำคัญ** ของ SIEM SIEM รับ Logs (Syslog, Windows Event, Agent) + NetFlow = **Context Enrichment** (ใครคุยกับใคร + Alert จาก Log = การวิเคราะห์ดีขึ้น)

คำถามที่พบบ่อย (FAQ)

NetFlow เข้ารหัสข้อมูลไหม?

NetFlow เอง **ไม่เข้ารหัส Payload** (เพราะไม่มี Payload) แต่ **การส่ง Export (UDP/TCP) ควรเข้ารหัส** (IPsec, TLS, หรือ Private Network Interconnect)

ต้องเปิด NetFlow บนทุก Device ไหม?

ควรเปิดบน **Edge Routers, Firewalls, Core Switches, WAN Links, Data Center Interconnects** จุดสำคัญที่ทราฟฟิกผ่าน

NetFlow ช่วย Detect DDoS ได้ไหม?

**ได้ดีมาก** เห็น Spike ใน Flow Count, Packet Rate, Byte Rate, New Source IPs, SYN Flood Patterns ได้ Near Real-time

NetFlow Open Source ไหม?

Protocol = Cisco Proprietary (แต่ Documented) | Collector/Analyzer = มี Open Source เยอะ (nProbe, ElastiFlow, GoFlow2)