NetFlow และ sFlow: วิเคราะห์ Traffic Flow บน Network อย่างละเอียด

NetFlow และ sFlow: วิเคราะห์ Traffic Flow บน Network อย่างละเอียด

NetFlow และ sFlow เป็นเทคโนโลยีสำหรับ collect และวิเคราะห์ traffic flow data จาก network devices ทำให้เห็นว่า traffic มาจากไหน ไปไหน ใช้ protocol อะไร bandwidth เท่าไหร่ เป็นเครื่องมือสำคัญสำหรับ capacity planning, security monitoring และ troubleshooting

ต่างจาก SNMP ที่บอกแค่ interface utilization รวม (เช่น port นี้ใช้ 80%) NetFlow/sFlow บอกรายละเอียดว่า traffic 80% นั้นมาจาก application อะไร user ไหน ไป destination ไหน ทำให้ตัดสินใจได้ดีกว่า บทความนี้จะอธิบาย NetFlow, sFlow, วิธี deploy และ tools ที่ใช้

NetFlow vs sFlow vs IPFIX

คุณสมบัติ NetFlow v5 NetFlow v9/IPFIX sFlow
Developer Cisco Cisco / IETF InMon (open standard)
Method Flow-based (100% packets) Flow-based (flexible templates) Sampling-based (1:N packets)
CPU Impact สูง สูง ต่ำ
Accuracy 100% (ทุก packet) 100% (ทุก packet) Statistical (sampling)
Vendor Support Cisco เท่านั้น Multi-vendor Multi-vendor (แพร่หลายที่สุด)
L2 Info ไม่มี มี (flexible templates) มี (L2-L7)
Scalability จำกัด ดี ดีมาก (low overhead)

Flow คืออะไร

Flow Definition

Flow คือ unidirectional sequence of packets ที่มี 5-tuple เหมือนกัน: Source IP, Destination IP, Source Port, Destination Port, Protocol (TCP/UDP/ICMP) ตัวอย่าง: PC (10.0.1.5:49152) → Web Server (203.0.113.10:443) TCP = 1 flow Web Server (203.0.113.10:443) → PC (10.0.1.5:49152) TCP = อีก 1 flow (reverse) Flow record เก็บข้อมูล: bytes, packets, timestamps, TCP flags, ToS

NetFlow Architecture

Components

Flow Exporter: Router/Switch ที่สร้าง flow records แล้ว export ไป collector ตัวอย่าง: Cisco router ที่เปิด NetFlow Flow Collector: Server ที่รับ flow records จาก exporters แล้วเก็บใน database ตัวอย่าง: ntopng, Elastiflow, PRTG Flow Analyzer: Interface สำหรับ query และ visualize flow data ตัวอย่าง: Grafana dashboards, ntopng web UI

sFlow Architecture

Sampling

sFlow ใช้ sampling แทนการ track ทุก packet: Counter Sampling: เก็บ interface counters ทุก N วินาที (เช่น ทุก 20 วินาที) Flow Sampling: sample 1 ใน N packets (เช่น 1:1000) copy packet header + metadata ส่งไป collector ข้อดี: CPU/memory overhead ต่ำมาก เหมาะกับ high-speed links (10G, 40G, 100G) ข้อเสีย: ไม่ 100% accurate (statistical) อาจ miss short-lived flows

Use Cases

Use Case วิธีใช้
Bandwidth Monitoring ดูว่า bandwidth ถูกใช้โดย application/user ไหนมากที่สุด
Capacity Planning วิเคราะห์ traffic trends เพื่อวางแผน upgrade
Security (DDoS Detection) ตรวจจับ traffic anomalies (spike, unusual patterns)
Troubleshooting หาว่า traffic ไหนทำให้ link saturated
QoS Validation ตรวจว่า QoS policies ทำงานถูกต้อง
Billing/Accounting ISP ใช้คิดค่า bandwidth ตาม usage

Configuration

NetFlow v9 บน Cisco Router

Global config: ip flow-export version 9 ip flow-export destination 10.0.20.50 2055 ip flow-export source Loopback0 ip flow-cache timeout active 1 ip flow-cache timeout inactive 15 Interface config: interface GigabitEthernet0/0 ip flow ingress ip flow egress

sFlow บน Switch

ตัวอย่าง (generic): sflow collector 10.0.20.50 6343 sflow polling-interval 20 sflow sampling-rate 1000 sflow enable

Open-Source Collectors

Tool Support จุดเด่น
ntopng NetFlow, sFlow, IPFIX Real-time visualization, DPI, alerts
Elastiflow NetFlow, sFlow, IPFIX ELK Stack integration, Kibana dashboards
pmacct NetFlow, sFlow, IPFIX Lightweight, flexible output (DB, Kafka)
GoFlow2 NetFlow, sFlow, IPFIX High-performance Go-based collector
Scrutinizer (Plixer) NetFlow, sFlow, IPFIX Commercial, enterprise-grade analytics

Best Practices

Sampling Rate

sFlow sampling rate ขึ้นกับ link speed: 100 Mbps: 1:200 – 1:500 1 Gbps: 1:1000 – 1:2000 10 Gbps: 1:2000 – 1:5000 40/100 Gbps: 1:5000 – 1:10000 sampling rate สูงเกินไป = miss flows, ต่ำเกินไป = CPU สูง

Storage

Flow data สร้าง volume มาก: ประมาณ 1-5 GB/day ต่อ 1 Gbps link (ขึ้นกับ flow count) เก็บ raw data 7-30 วัน aggregated data 90 วัน – 1 ปี ใช้ time-series database (InfluxDB, Elasticsearch) สำหรับ query เร็ว

ทิ้งท้าย: Flow Analysis คือ Must-Have สำหรับ Network Engineer

NetFlow/sFlow ให้ visibility ที่ SNMP ให้ไม่ได้ เห็น traffic ระดับ application/user เริ่มจาก sFlow (overhead ต่ำ, multi-vendor) + ntopng (ฟรี, ง่าย) เปิด flow export บน core switches/routers ก่อน แล้วค่อยขยาย

อ่านเพิ่มเติมเกี่ยวกับ SNMP Monitoring และ Network Monitoring Grafana Prometheus ที่ siamlancard.com หรือจาก icafeforex.com และ siam2r.com

จัดส่งรวดเร็วส่งด่วนทั่วประเทศ
รับประกันสินค้าเคลมง่าย มีใบรับประกัน
ผ่อนชำระได้บัตรเครดิต 0% สูงสุด 10 เดือน
สะสมแต้ม รับส่วนลดส่วนลดและคะแนนสะสม

© 2026 SiamLancard — จำหน่ายการ์ดแลน อุปกรณ์ Server และเครื่องพิมพ์ใบเสร็จ

SiamLancard
Logo
Free Forex EA Download — XM Signal · EA Forex ฟรี
iCafeForex.com - สอนเทรด Forex | SiamCafe.net
Shopping cart