Packet Capture Tools and Methods
Wireshark: the most widely used open-source packet analyzer. Captures all frames visible to the network interface, displaying protocol details decoded from raw bytes. Filters: capture filters (applied during capture, BPF syntax) limit what is captured. Display filters (applied after capture) control what is shown — 'ip.addr == 192.168.1.1' shows only traffic to/from that IP, 'tcp.port == 443' shows HTTPS traffic.
tcpdump: command-line packet capture for Linux/Unix/macOS. Used in environments without GUI access. Same underlying library as Wireshark (libpcap). Output can be saved to pcap files and opened in Wireshark. Syntax: 'tcpdump -i eth0 host 10.0.0.1 and port 80 -w capture.pcap'.
Port mirroring (SPAN — Switched Port Analyzer): copies traffic from one or more switch ports to a monitoring port where a capture device is connected. Without SPAN, a device connected to a switched network only sees its own traffic (and broadcasts). SPAN allows capturing traffic between other devices. Network TAP (Test Access Point): a passive hardware device that creates a copy of all traffic on a link without affecting the traffic — more reliable than SPAN for high-speed links.
Interpreting Captures
TCP three-way handshake in a capture: SYN → SYN-ACK → ACK. Successful connection establishment. TCP RST (Reset): abrupt connection termination — indicates a rejected connection (firewall blocking, no service listening on port, or host down). TCP FIN: normal graceful connection close.
ICMP in captures: echo request (type 8) and echo reply (type 0) = ping. ICMP destination unreachable (type 3) with code 13 = administratively prohibited (firewall). TTL exceeded (type 11) = traceroute. Analyzing ICMP helps diagnose connectivity and routing issues.
Protocol hierarchy: Wireshark shows the breakdown of protocols in a capture — what percentage of traffic is TCP, UDP, HTTP, DNS, etc. Helps identify unexpected protocols or traffic patterns that indicate security issues or misconfiguration.