Wireshark — Packet Analysis Complete Guide
Capture safely, filter effectively, and reason from packet evidence.
A Packet Analyzer Is a Microscope
Wireshark captures packets from an interface or reads a saved capture file, then decodes protocol fields into a searchable view. It is useful when counters and logs tell you that something failed but not what exchanged on the wire. A packet capture is evidence, not an automatic explanation: you still need a question, a time range, and an understanding of expected protocol behaviour.
Start with a narrow question: “Did this client send a DNS query to the expected resolver?” or “Which side closed this TCP connection first?” Avoid collecting everything by default. Captures can include personal data, internal addresses, cookies, credentials sent by insecure protocols, and confidential payloads.
Capture Filters and Display Filters
A capture filter is applied while recording and limits what enters the file; it uses the Berkeley Packet Filter (BPF) syntax shared with tools such as tcpdump. A display filter is applied after capture and hides nonmatching packets from the current view without deleting them. Use a display filter to explore; use a capture filter when minimising collection is important.
# BPF capture filter examples
host 127.0.0.1
port 53
host 127.0.0.1 and port 8080
# Wireshark display filter examples
dns
ip.addr == 127.0.0.1 && tcp.port == 8080
tcp.flags.syn == 1 && tcp.flags.ack == 0
http.response.code >= 400Filter expressions are protocol-aware: tcp.port == 443 matches a TCP port, while HTTPS may use other transports. A filter that returns nothing can mean the wrong interface, wrong time window, no traffic, or a syntax mistake. Confirm the capture itself before concluding that a packet never existed.
Read a TCP Conversation
Use packet details to inspect layers from frame through link, IP, transport, and application protocol. For TCP, look for the handshake, sequence and acknowledgement numbers, retransmissions, window updates, FIN, and RST. The “Follow TCP Stream” view reconstructs application bytes for that connection when they are available. It cannot reveal encrypted TLS application content without authorised decryption material and an appropriate setup.
Timing is often more useful than payload. A long gap before a SYN-ACK may suggest a path, firewall, or server delay; repeated retransmissions can indicate loss; an immediate RST indicates a different failure than a timeout. Compare both directions where possible and remember that asymmetric routing or capture loss may make one side incomplete.
# Generate a small, local HTTP exchange in a controlled lab
python3 -m http.server 8080 --bind 127.0.0.1
# In another terminal, request only the local test server
curl -I http://127.0.0.1:8080/
# Then inspect: SYN, SYN/ACK, ACK, HTTP request, response, closeA Practical Analysis Workflow
Record the problem statement, interface, start and stop times, capture filter, and clock source. Reproduce one small exchange if safe. First identify endpoints and protocols, then narrow to a conversation, then inspect fields and timing. Save a filtered copy only when needed, and keep the original evidence protected. Add notes describing what the capture can and cannot show.
For a DNS issue, check query name and type, resolver address, response code, and response time. For a TCP issue, identify where the handshake stops. For TLS, inspect ClientHello/server-name metadata and alert/handshake completion where visible, but do not assume encrypted application data is readable.
Capture Hygiene and Limitations
Use the smallest capture scope that answers your question, store files with restrictive permissions, define retention, and redact or securely transfer approved extracts. A SPAN port or virtual interface can drop packets under load. Wi-Fi monitor-mode visibility differs from normal client capture, and encryption limits payload interpretation. Offloads such as segmentation and checksum calculation can make host captures look different from packets on the physical wire.
Do not use “Follow Stream” on data you are not authorised to view. Be particularly careful with unencrypted protocols and TLS key logs. If a team needs decryption for a legitimate investigation, use an approved, documented process that protects keys and limits access.
Mistakes, Practice, and Review
Common mistakes: confusing capture and display filters; assuming an empty filtered view means no traffic; interpreting host-offload artefacts as wire corruption; and sharing unredacted capture files. Another error is treating one packet or one trace as definitive without checking the full conversation and capture point.
Practice: (1) Capture a local HTTP request and identify the TCP handshake. (2) Write a display filter for DNS failures. (3) Explain why a TCP retransmission does not by itself identify the faulty hop. (4) Compare a capture filter with an equivalent display filter. (5) Draft a safe handling checklist for a pcap that may contain personal data.
🎯 Key Takeaways
- ✓Wireshark decodes packet evidence; it does not replace a clear troubleshooting question.
- ✓Capture filters limit collection; display filters only change what is visible in the current view.
- ✓TCP flags, sequence numbers, retransmissions, and timing can reveal where a conversation stalled.
- ✓TLS payload is encrypted; visible metadata and timing do not equal application content.
- ✓Capture point, packet drops, offloads, clock accuracy, and asymmetric routing shape what you observe.
- ✓Minimise, protect, redact, and retain pcaps under an authorised data-handling process.
HELP US IMPROVE
How was this lesson?
Your note is shared with the Chaduvuko team for review. Please don’t include personal or sensitive information.
Spotted a mistake or something unclear? Suggest a fix on GitHub or email us. Select the text first and it is quoted for you.
Discussion
0Have a better approach? Found something outdated? Share it — your knowledge helps everyone learning here.
