Network Packet Capture Tools
What you'll learn: How to use tcpdump and Wireshark to capture and analyze individual network packets for deep troubleshooting.
When VPC Flow Logs (which you just learned about) show what traffic is flowing, packet capture tools let you see inside each packet—every header, flag, and byte of payload. Think of Flow Logs as your traffic camera footage showing cars passing by, while packet capture is like stopping each car and inspecting its contents.
Understanding Packet Capture
tcpdump is a command-line tool that captures raw network packets in real-time. It's typically used directly on Linux servers, containers, or network appliances to grab traffic as it happens:
# Capture packets on interface eth0
tcpdump -i eth0
# Capture HTTP traffic only
tcpdump -i eth0 port 80
# Save to file for later analysis
tcpdump -i eth0 -w capture.pcap
Wireshark is a graphical tool that excels at analyzing captured packets. You can open tcpdump's .pcap files in Wireshark to see color-coded protocols, reassembled TCP streams, and detailed packet breakdowns.
When to Use Packet Capture
Use these tools when you need to:
- Debug intermittent connection failures
- Verify TLS handshake issues
- Identify malformed packets or protocol violations
- Analyze application-layer protocol details (HTTP headers, DNS queries)
- Confirm firewall rules are working as expected
Cloud Considerations
In cloud environments, you may need packet capture on virtual interfaces or within containers. Some managed services don't allow direct packet capture, so you'll capture at the nearest accessible point (load balancer, NAT gateway, or host).
Key Takeaway: tcpdump captures packets at the wire level for detailed debugging, while Wireshark provides rich visualization—together they're essential for diagnosing complex network issues that logs alone can't explain.