

Network Traffic Analysis: Wireshark, tcpdump และ Packet Capture
Network Traffic Analysis คือการจับและวิเคราะห์ packets ที่วิ่งผ่าน network เพื่อ troubleshoot ปัญหา, ตรวจจับ security threats และ optimize performance Wireshark เป็น GUI-based analyzer ที่ทรงพลังที่สุด tcpdump เป็น command-line tool ที่เบาและเร็ว ทั้งสองเป็น essential tools สำหรับ network engineers
Network issues หลายอย่าง ไม่สามารถ debug ได้จาก logs หรือ SNMP เพียงอย่างเดียว ต้องดู actual packets จึงจะเห็นว่าเกิดอะไรขึ้นจริง เช่น TCP retransmissions, DNS failures, TLS handshake errors หรือ malicious traffic Packet capture เป็น ground truth ของ network communication
Packet Capture Methods
| Method | วิธีทำ | เหมาะกับ |
|---|---|---|
| SPAN/Mirror Port | Switch copy traffic จาก source port ไป monitor port | Switch-level capture |
| Network TAP | Hardware device ที่ copy traffic แบบ passive (inline) | Production traffic, no packet drops |
| Host-based | Capture บน server/endpoint โดยตรง (tcpdump, Wireshark) | Application-level troubleshooting |
| Inline Device | Firewall, IDS/IPS capture traffic ที่ผ่าน | Security analysis |
| Cloud VPC Flow Logs | AWS/Azure/GCP flow logs (metadata, ไม่ใช่ full packet) | Cloud traffic analysis |
tcpdump
| Command | ผลลัพธ์ |
|---|---|
| tcpdump -i eth0 | Capture ทุก packet บน eth0 |
| tcpdump -i eth0 -c 100 | Capture 100 packets แล้วหยุด |
| tcpdump -i eth0 -w capture.pcap | Save เป็น pcap file (เปิดใน Wireshark) |
| tcpdump -i eth0 host 192.168.1.1 | Filter เฉพาะ traffic ไป/จาก host นี้ |
| tcpdump -i eth0 port 80 | Filter เฉพาะ port 80 (HTTP) |
| tcpdump -i eth0 tcp and port 443 | Filter TCP port 443 (HTTPS) |
| tcpdump -i eth0 src 10.0.0.1 and dst port 53 | Filter DNS queries จาก specific source |
| tcpdump -i eth0 -nn -v | No name resolution + verbose output |
| tcpdump -r capture.pcap | Read จาก pcap file |
tcpdump BPF Filters
| Filter | ความหมาย |
|---|---|
| host 10.0.0.1 | Traffic ไป/จาก host |
| src host 10.0.0.1 | Traffic จาก source เท่านั้น |
| dst host 10.0.0.1 | Traffic ไป destination เท่านั้น |
| net 10.0.0.0/24 | Traffic ใน subnet |
| port 80 | TCP/UDP port 80 |
| tcp | TCP traffic เท่านั้น |
| udp | UDP traffic เท่านั้น |
| icmp | ICMP traffic (ping) |
| not port 22 | Exclude SSH traffic |
| tcp[tcpflags] & (tcp-syn) != 0 | TCP SYN packets เท่านั้น |
Wireshark
| Feature | รายละเอียด |
|---|---|
| GUI | Packet list + packet details + packet bytes (3-pane view) |
| Display Filters | Filter packets หลัง capture (ต่างจาก capture filters) |
| Protocol Dissectors | Decode 3000+ protocols (HTTP, DNS, TLS, BGP, OSPF, etc.) |
| Follow Stream | Right-click → Follow → TCP/UDP/HTTP stream (ดู conversation) |
| Statistics | Conversations, endpoints, protocol hierarchy, I/O graphs |
| Expert Info | Automatic warnings (retransmissions, resets, errors) |
| Coloring Rules | Color-code packets ตาม type (errors=red, TCP=green, etc.) |
Wireshark Display Filters
| Filter | ผลลัพธ์ |
|---|---|
| ip.addr == 10.0.0.1 | Traffic ไป/จาก IP |
| tcp.port == 443 | TCP port 443 |
| http.request.method == “GET” | HTTP GET requests |
| dns.qry.name contains “example” | DNS queries ที่มี “example” |
| tcp.analysis.retransmission | TCP retransmissions (performance issue) |
| tcp.flags.reset == 1 | TCP RST packets (connection refused/reset) |
| tls.handshake.type == 1 | TLS Client Hello |
| frame.time_delta > 1 | Packets ที่ห่างกัน > 1 second (latency) |
| !(arp or dns or icmp) | Exclude ARP, DNS, ICMP |
Common Troubleshooting Patterns
| Issue | What to Look For | Wireshark Filter |
|---|---|---|
| Slow connection | TCP retransmissions, high RTT, window size issues | tcp.analysis.retransmission |
| Connection refused | TCP RST after SYN | tcp.flags.reset == 1 |
| DNS failure | NXDOMAIN, SERVFAIL, no response | dns.flags.rcode != 0 |
| TLS errors | Handshake failure, certificate issues | tls.alert_message |
| Packet loss | TCP retransmissions, duplicate ACKs | tcp.analysis.duplicate_ack |
| MTU issues | ICMP “Fragmentation Needed” (DF bit set) | icmp.type == 3 and icmp.code == 4 |
| ARP issues | ARP requests without replies, gratuitous ARP | arp |
TCP Analysis
| TCP Event | ความหมาย | Concern Level |
|---|---|---|
| SYN → SYN-ACK → ACK | Normal 3-way handshake | Normal |
| Retransmission | Packet ส่งซ้ำ (original lost) | Warning (packet loss) |
| Duplicate ACK | Receiver ส่ง ACK ซ้ำ (missing segment) | Warning |
| Fast Retransmission | Retransmit หลัง 3 duplicate ACKs | Warning (selective loss) |
| Zero Window | Receiver buffer full (stop sending) | Warning (receiver slow) |
| RST | Connection reset (refused or aborted) | Error |
| FIN → ACK → FIN → ACK | Normal connection close (4-way) | Normal |
Other Tools
| Tool | Type | จุดเด่น |
|---|---|---|
| tshark | CLI (Wireshark’s CLI) | Wireshark dissectors ใน command line |
| ngrep | CLI | grep for network traffic (pattern matching) |
| Zeek (Bro) | Network Security Monitor | Generate logs จาก pcap (conn, dns, http, ssl logs) |
| NetworkMiner | GUI | Extract files, images, credentials จาก pcap |
| Moloch/Arkime | Full packet capture + search | Large-scale indexed packet capture |
ทิ้งท้าย: Packet Capture = Network Ground Truth
Traffic Analysis tcpdump = lightweight CLI capture, Wireshark = powerful GUI analysis SPAN/TAP สำหรับ capture traffic จาก switch BPF filters (tcpdump) สำหรับ capture-time filtering Display filters (Wireshark) สำหรับ post-capture analysis TCP retransmissions, RST, zero window = common performance indicators Follow TCP Stream สำหรับดู full conversation
อ่านเพิ่มเติมเกี่ยวกับ Network Troubleshooting Methodology และ TCP IP Deep Dive ที่ siamlancard.com หรือจาก icafeforex.com และ siam2r.com
อ่านเพิ่มเติม: เทรด Forex | กลยุทธ์เทรดทอง
FAQ
Network Traffic Analysis: Wireshark, tcpdump และ Packet Capture คืออะไร?
Network Traffic Analysis: Wireshark, tcpdump และ Packet Capture เป็นหัวข้อสำคัญในวงการเทคโนโลยีที่ช่วยให้การทำงานมีประสิทธิภาพมากขึ้น ไม่ว่าจะเป็นด้าน IT, Network หรือ Server Management
ทำไมต้องเรียนรู้เรื่อง Network Traffic Analysis: Wireshark, tcpdump และ Packet Capture?
เพราะ Network Traffic Analysis: Wireshark, tcpdump และ Packet Capture เป็นทักษะที่ตลาดต้องการสูง และช่วยให้คุณแก้ปัญหาในงานจริงได้อย่างมืออาชีพ การเรียนรู้ตั้งแต่วันนี้จะเป็นประโยชน์ในระยะยาว
Network Traffic Analysis: Wireshark, tcpdump และ Packet Capture เหมาะกับผู้เริ่มต้นไหม?
ได้แน่นอนครับ บทความนี้เขียนให้เข้าใจง่าย เหมาะทั้งผู้เริ่มต้นและผู้มีประสบการณ์ มี step-by-step guide พร้อมตัวอย่างให้ทำตามได้ทันที
Network Traffic Analysis: Wireshark, tcpdump และ Packet Capture — ทำไมถึงสำคัญ?
Network Traffic Analysis: Wireshark, tcpdump และ Packet Capture เป็นหัวข้อสำคัญในวงการ IT ที่ System Admin, Network Engineer และ DevOps Engineer ควรเข้าใจเป็นอย่างดี การรู้เรื่องนี้จะช่วยให้ทำงานได้มีประสิทธิภาพมากขึ้น แก้ปัญหาได้เร็วขึ้น และเป็นทักษะที่ตลาดแรงงานต้องการสูง
เริ่มต้นเรียนรู้ Network Traffic Analysis: Wireshark, tcpdump และ Packet Capture
แนะนำ path การเรียนรู้:
- อ่านเอกสาร official — เริ่มจาก documentation ของเครื่องมือ/เทคโนโลยีนั้นๆ
- ทำ lab จริง — ตั้ง VM หรือ Docker container แล้วลองทำตาม tutorial
- ทำ project จริง — ใช้กับงานจริงหรือ side project เรียนรู้จากปัญหาที่เจอ
- อ่าน best practices — ศึกษาว่าคนอื่นใช้งานจริงยังไง มี pitfall อะไร
- เข้า community — Reddit, Stack Overflow, Thai IT groups เรียนรู้จากคนอื่น
เครื่องมือที่แนะนำสำหรับ Network Traffic Analysis: Wireshark, tcpdump และ Packet Capture
| เครื่องมือ | ใช้สำหรับ | ราคา |
|---|---|---|
| VS Code | Code editor หลัก | ฟรี |
| Docker | Container + Lab environment | ฟรี |
| Git/GitHub | Version control | ฟรี |
| VirtualBox/Proxmox | Virtualization สำหรับ lab | ฟรี |
FAQ — Network Traffic Analysis: Wireshark, tcpdump และ Packet Capture
Network Traffic Analysis: Wireshark, tcpdump และ Packet Capture คืออะไร?
Network Traffic Analysis: Wireshark, tcpdump และ Packet Capture เป็นเทคโนโลยี/ความรู้ด้าน IT ที่ช่วยให้การทำงานมีประสิทธิภาพมากขึ้น อ่านรายละเอียดทั้งหมดในบทความนี้
Network Traffic Analysis: Wireshark, tcpdump และ Packet Capture เหมาะกับผู้เริ่มต้นไหม?
เหมาะครับ บทความนี้อธิบายตั้งแต่พื้นฐาน มี step-by-step guide พร้อมตัวอย่างให้ทำตาม
เรียนรู้ Network Traffic Analysis: Wireshark, tcpdump และ Packet Capture ใช้เวลานานไหม?
พื้นฐานใช้เวลา 1-2 สัปดาห์ ขั้นกลาง 1-3 เดือน ขั้นสูงต้องใช้ประสบการณ์จริง 6 เดือน+
อ่านเพิ่มเติม: SiamLanCard.com | iCafeForex.com | Siam2R.com
Best Practices สำหรับ Network Traffic Analysis: Wireshark, tcpdump และ Packet Capture
Network Traffic Analysis: Wireshark, tcpdump และ Packet Capture มี best practices ที่ผู้เชี่ยวชาญแนะนำ:
- Documentation — จด document ทุกอย่างที่ทำ เพื่อให้คนอื่น (หรือตัวเอง 6 เดือนหลัง) เข้าใจ
- Version Control — ใช้ Git สำหรับทุก config/code เก็บ history ย้อนกลับได้
- Automation — automate task ที่ทำซ้ำๆ ด้วย script/Ansible/Terraform
- Monitoring — ตั้ง monitoring + alerting ให้รู้ปัญหาก่อน user
- Backup — กฎ 3-2-1 เสมอ 3 copies, 2 media, 1 offsite
ทรัพยากรเรียนรู้เพิ่มเติม
- Official Documentation — แหล่งเรียนรู้ที่ดีที่สุด อ่าน docs ก่อนเสมอ
- YouTube Tutorials — ดู video walkthrough เข้าใจเร็วกว่าอ่าน
- GitHub Examples — ดู code ของคนอื่น เรียนรู้จาก real projects
- Lab Practice — ตั้ง VM/Docker ฝึกจริง ไม่มีอะไรดีกว่าลงมือทำ
อ่านเพิ่มเติม: iCafeForex | XM Signal EA ฟรี | SiamLanCard | Siam2R
Best Practices สำหรับ Network Traffic Analysis: Wireshark, tcpdump และ Packet Capture
Network Traffic Analysis: Wireshark, tcpdump และ Packet Capture มี best practices ที่ผู้เชี่ยวชาญแนะนำ:
- Documentation — จด document ทุกอย่างที่ทำ เพื่อให้คนอื่น (หรือตัวเอง 6 เดือนหลัง) เข้าใจ
- Version Control — ใช้ Git สำหรับทุก config/code เก็บ history ย้อนกลับได้
- Automation — automate task ที่ทำซ้ำๆ ด้วย script/Ansible/Terraform
- Monitoring — ตั้ง monitoring + alerting ให้รู้ปัญหาก่อน user
- Backup — กฎ 3-2-1 เสมอ 3 copies, 2 media, 1 offsite
ทรัพยากรเรียนรู้เพิ่มเติม
- Official Documentation — แหล่งเรียนรู้ที่ดีที่สุด อ่าน docs ก่อนเสมอ
- YouTube Tutorials — ดู video walkthrough เข้าใจเร็วกว่าอ่าน
- GitHub Examples — ดู code ของคนอื่น เรียนรู้จาก real projects
- Lab Practice — ตั้ง VM/Docker ฝึกจริง ไม่มีอะไรดีกว่าลงมือทำ
อ่านเพิ่มเติม: iCafeForex | XM Signal EA ฟรี | SiamLanCard | Siam2R