Skip to content
Visual explainer 3h 30m to learn 5 steps

Wireshark analysis

Analyse a capture in Wireshark to find handshakes, retransmissions and slow responses.

By Invicly Tech, , in Computer Networking. About 11 minutes to read.

Topic 39 of 51

In short

Wireshark decodes captured packets into every protocol layer and lets you filter, follow conversations and graph behaviour. Display filters narrow thousands of packets to the ones that matter, and expert analysis flags retransmissions, resets and zero windows. It is the fastest way to prove what actually happened on the wire.

Explained simply

Wireshark opens a capture file and shows every packet in a clear window. It knows hundreds of protocols, so it can show a TCP packet, the TLS handshake inside it and the HTTP request inside that, each layer as a section you can expand.

A capture often holds thousands of packets. Display filters are how you find the few that matter. You type a short rule, such as dns or ip.addr == 10.0.0.5, and Wireshark hides everything else. The original packets are still there; you are only changing the view.

Wireshark also does the boring work for you. It can rebuild a whole conversation into readable text, list which hosts talked the most, and mark suspicious packets such as retransmissions (packets sent again because they got lost) and resets (connections cut off).

Most web traffic today is encrypted with TLS, so the content looks like random bytes. If you control the browser or the app, you can make it save its session keys to a file, and Wireshark will use them to show the real requests. This works only for your own traffic.

Press Play on a diagram to walk through it one step at a time.

LayersWireshark's packet detail pane
  1. 1
    Frame

    Capture time, length, interface.

  2. 2
    Ethernet II

    Source and destination MAC.

  3. 3
    Internet Protocol

    Source and destination IP, TTL.

  4. 4
    TCP

    Ports, flags, sequence and ACK numbers.

  5. 5
    TLS / HTTP

    Handshake messages or request lines.

MapHandy display filters by question
What do you want to find?
  • One host or service
    • ip.addr == 10.0.0.5
    • tcp.port == 443
    • tcp.stream eq 7
  • Connection problems
    • tcp.flags.reset == 1
    • tcp.analysis.retransmission
    • tcp.analysis.zero_window
  • Slow answers
    • http.time > 1
    • dns.time > 0.5
  • Errors
    • http.response.code >= 400
    • dns.flags.rcode == 3
  • TLS
    • tls.handshake.type == 2
    • tls.alert_message

In depth

Display filter language

Display filters use field names from the protocol tree: ip.src, ip.addr, tcp.port, udp.port, dns.qry.name, http.host, tls.handshake.extensions_server_name. Compare with ==, !=, >, <, >=, <=, and combine with && (and), || (or) and ! (not). Strings need double quotes: http.host == "api.example.com". contains matches part of a value and matches uses a regular expression.

The bar turns green for valid syntax and red for errors, which catches the common mistake of typing tcpdump syntax like host 10.0.0.5. A quick trick: right-click any field in the packet details and choose Apply as Filter, and Wireshark writes the filter for you. Save filters you use often as filter buttons. tcp.stream eq 7 shows exactly one TCP connection, because Wireshark numbers every connection it sees.

  • ip.addr == 10.0.0.5 matches source or destination
  • !(arp || dns) hides background noise
  • tls.handshake.extensions_server_name contains "bank"
  • frame.time_delta_displayed > 1 finds long gaps

Following streams and measuring response time

Follow TCP Stream (right-click a packet, Follow, TCP Stream) joins all the data of one connection and shows it as a conversation, client in one colour and server in another. For HTTP/1.1 you can read the whole request and response. Follow HTTP Stream also undoes compression. Closing the window applies a tcp.stream filter for that connection.

For timing, change View, Time Display Format to Seconds Since Previous Displayed Packet, then filter one stream: big gaps jump out. Wireshark also calculates times for you: http.time is the time from a request to its response, dns.time does the same for DNS, and tcp.time_delta (after enabling Calculate conversation timestamps in the TCP protocol preferences) shows the time since the previous packet in the same connection. Add any of these as a column (right-click, Apply as Column) and sort to find the slowest responses.

FlowFinding the slowest request in a capture
  1. 1
    Filter responses

    http.response or dns.flags.response == 1

  2. 2
    Add a timing column

    http.time or dns.time, Apply as Column

  3. 3
    Sort descending

    Slowest response at the top

  4. 4
    Follow its stream

    See the request that caused it

  5. 5
    Check the gap

    Server delay or network retransmits?

Statistics views for the big picture

Before reading single packets, get an overview from the Statistics menu. Protocol Hierarchy shows what share of traffic is TCP, UDP, TLS, DNS and so on, which quickly reveals odd traffic. Conversations lists every pair of hosts (and every TCP or UDP connection) with packets, bytes and duration; sort by bytes to find the heavy talkers. Endpoints does the same per host.

I/O Graphs plots packets or bytes per second over time; add a graph with the filter tcp.analysis.retransmission to see whether retransmissions line up with a slowdown. Statistics, TCP Stream Graphs, Stevens plots sequence numbers over time for one connection: a smooth line is a healthy transfer, flat parts are stalls. Analyze, Expert Information groups all warnings (retransmissions, duplicate ACKs, zero windows, resets) in one place.

  • Protocol Hierarchy: what kinds of traffic
  • Conversations: who talks to whom, how much
  • I/O Graphs: rate over time with filters
  • Expert Information: all warnings grouped

Spotting retransmissions, resets and zero windows

Wireshark tracks sequence numbers and flags problems for you, all under tcp.analysis. tcp.analysis.retransmission marks data sent again because no ACK arrived; a few are normal, but many point to loss on the path. tcp.analysis.duplicate_ack and tcp.analysis.fast_retransmission show the receiver telling the sender that a segment is missing. tcp.analysis.zero_window means the receiver's buffer is full, so the slow side is the receiving application, not the network.

Resets are matched with tcp.flags.reset == 1. A reset right after a SYN means the port is closed. A reset in the middle of a session often comes from a firewall or load balancer that timed out an idle connection, or from an app that crashed. Check which IP sent it and the TTL: a TTL very different from the server's other packets suggests a middlebox forged the reset.

CompareWho is slow? Network versus application
Network problem
  • Many retransmissions
  • Duplicate ACKs
  • Gaps right after lost segments
  • Loss shows on the I/O graph
Server app slow
  • Quick ACK to the request
  • Long wait before the first response byte
  • High http.time, clean TCP
  • No retransmissions
Client app slow
  • Client advertises zero window
  • Server waits to send
  • tcp.analysis.zero_window hits
  • Receiver not reading fast enough

Decrypting TLS with a key log file

TLS encrypts the payload with session keys that never cross the network, so a capture alone cannot be decrypted. But Chrome, Firefox and curl (when built with OpenSSL and similar libraries) write those session secrets to a file if the SSLKEYLOGFILE environment variable is set. Start the browser from a terminal with SSLKEYLOGFILE=$HOME/tls-keys.log, browse, and capture at the same time.

In Wireshark open Edit, Preferences, Protocols, TLS, and set (Pre)-Master-Secret log filename to that file. Packets that showed Application Data now show HTTP or HTTP/2 frames. This works for TLS 1.2 and 1.3, including forward-secret ciphers, because it uses per-session secrets rather than the server's private key. Use it only on traffic you own, delete the key file afterwards, and never share it with a capture unless you mean to share the decrypted content.

  • SSLKEYLOGFILE=~/tls-keys.log firefox
  • Preferences, Protocols, TLS, (Pre)-Master-Secret log filename
  • Works for TLS 1.3, unlike the old RSA private key method

Learn it in 5 short steps

About 40m each. Track them with a timer in your plan.

  1. 1
    Apply display filters~40m
  2. 2
    Follow TCP and HTTP streams~40m
  3. 3
    Use statistics and conversations views~40m
  4. 4
    Spot retransmissions and resets~40m
  5. 5
    Decrypt TLS with a key log file~40m

Key points

  • Display filters (ip.addr == 10.0.0.5) differ from capture filters (host 10.0.0.5).
  • Follow TCP Stream reassembles a whole conversation.
  • Statistics, Conversations ranks hosts by traffic volume.
  • With an SSLKEYLOGFILE from the browser, Wireshark can decrypt TLS.

Key terms

Tap a card to flip it. 0/4 known

Examples

text
ip.addr == 10.0.0.5 && tcp.port == 443
tcp.flags.syn == 1 && tcp.flags.ack == 0
tcp.analysis.flags
dns.flags.rcode != 0
http.response.code >= 500
tls.handshake.type == 1

Useful display filters; the last one shows ClientHello messages.

Why does the report page take 6 seconds?

Step 1: open the capture and filter http.response. Step 2: add http.time as a column and sort it; one response to GET /report took 5.8 s. Step 3: follow that TCP stream. The server ACKed the request in 1 ms and sent no data for 5.8 s, and there are no retransmissions. Step 4: conclusion: the network is healthy and the server app is slow, so the next step is the app's database queries, not the network.

text
http.response && http.time > 1
# right-click http.time > Apply as Column, sort descending
tcp.stream eq 14
# then check for network trouble in the same stream:
tcp.stream eq 14 && tcp.analysis.flags

Uploads stall over the VPN

Large uploads stop after a few seconds. Step 1: open Expert Information; it shows many retransmissions in one stream. Step 2: filter that stream and look at the sizes: segments of 1448 bytes are retransmitted over and over, while small packets pass. Step 3: filter icmp.type == 3 && icmp.code == 4 and find no Fragmentation Needed messages, so path MTU discovery is being blocked. Step 4: lower the MTU on the VPN interface or allow that ICMP type, then capture again to confirm the stalls are gone.

text
tcp.analysis.retransmission
tcp.stream eq 3 && tcp.len > 1400
icmp.type == 3 && icmp.code == 4
# tshark equivalent on a server:
# tshark -r up.pcap -Y 'tcp.analysis.retransmission' -T fields -e tcp.stream -e tcp.len

Quick reference

  • Display filter: ip.addr == X; capture filter: host X; do not mix them
  • tcp.stream eq N shows one connection; Follow TCP Stream sets it for you
  • tcp.analysis.flags shows every TCP problem Wireshark detected
  • http.time and dns.time measure request-to-response time; add them as columns
  • Statistics, Conversations: sort by bytes to find the heaviest talkers
  • Analyze, Expert Information: retransmissions, resets and zero windows in one list
  • SSLKEYLOGFILE plus the TLS key log preference decrypts your own HTTPS
  • tshark -r f.pcap -Y 'filter' gives the same filtering on the command line

Common mistakes

  • Typing capture-filter syntax into the display filter bar.
  • Sharing captures that contain passwords, cookies or personal data.

Quick quiz

Pick an answer to see if you're right and why.

Question 1

1Which is a valid Wireshark display filter for traffic to or from 10.0.0.5?

Question 2

2A server's response took 4 s, the request was ACKed at once, and there are no retransmissions. What is the likely cause?

Question 3

3What does tcp.analysis.zero_window indicate?

Question 4

4Why can a key log file decrypt TLS 1.3 when the server's private key cannot?

Question 5

5Which view shows which pairs of hosts exchanged the most bytes?

0/5 answered

Practice exercises

Try each one yourself first. Use the hint if you get stuck, then compare with the solution.

  1. Exercise 1easy

    Open any capture of your own browsing and write display filters that show only DNS queries for names containing "google", and only TLS ClientHello messages.

  2. Exercise 2medium

    Use tshark to list the five slowest HTTP responses in a capture with their stream number, host and time.

  3. Exercise 3hard

    Capture and decrypt your own HTTPS traffic to a site using a key log file, and show the HTTP/2 request path in Wireshark.

Check yourself

Answer in your head, reveal, then be honest with yourself.

Feel confident about this topic?

Frequently asked questions

Is Wireshark free?
Yes. Wireshark is free, open-source software released under the GNU GPL, and it runs on Windows, macOS and Linux.
Can Wireshark capture other people's traffic on my Wi-Fi?
On a normal switched or encrypted network you mostly see only your own traffic and broadcasts. Capturing others' traffic without permission is illegal in many places.
What is the difference between Wireshark and tshark?
tshark is Wireshark's command-line version. It uses the same dissectors and display filters, so it is ideal for servers and scripts.
Why are some packets shown in black with red text?
That is the default colouring rule for packets with TCP problems, such as retransmissions, duplicate ACKs or out-of-order segments.

Go deeper

ShareXLinkedInWhatsApp