When an “the application is slow” complaint comes in, monitoring graphs usually look clean and the debate starts: is it the network, the server or DNS? The only thing that ends this debate is packet-level evidence. Analysis with Wireshark has two halves, and both are equally important: capturing from the right point with the right method, then reading the trace and placing TCP, DNS and DHCP problems correctly. Below we explain both in the order we apply them on the console.
When do you need to capture packets?
Packet capture is an expensive tool: it brings storage, analysis time and privacy overhead. It isn’t the first step. It comes into play when interface counters, flow data and logs can’t narrow down the problem. Typical cases:
- A specific application being slow while bandwidth graphs are normal
- Intermittent connection drops, session resets (RST) or timeouts
- A client not getting an IP or getting it late, name resolution taking long
- Verifying or refuting the vendor support team’s or application owner’s claim that “the network is dropping packets”
For the general layer-by-layer troubleshooting order, the network slowness troubleshooting checklist is the starting point. To see who traffic flows from and to, flow data such as NetFlow, sFlow and IPFIX is often enough instead of packets. Packet capture starts where these two can’t answer the “why” question.
Choosing the capture point: SPAN, RSPAN, TAP and the endpoint
Traces of the same session taken from two different points tell different stories. If a TCP retransmission is visible on the client side but not on the server side, the loss is on the path in between. The hypothesis you want to test determines the capture point. Mirroring ports at random is a waste of time.
| Method | Strength | Limitation |
|---|---|---|
| SPAN (local port mirroring) | Needs no extra hardware, quick to set up | Doesn’t copy errored frames; copies can drop under load |
| RSPAN / ERSPAN | Carries traffic from a remote switch to the center | Extra VLAN or GRE traffic; uplink load |
| Network TAP | Passive, full copy from the physical layer | Physical intervention in the link, extra hardware |
| Capture at the endpoint | Sees what the application sees | NIC offload can mislead; load on the server |
A trap you may encounter with SPAN is oversubscription. When a 1 Gbps source port is mirrored in both directions (rx+tx), up to 2 Gbps of total traffic may not fit into a 1 Gbps destination port; the excess is dropped. The “loss” seen in the trace isn’t real in this case. When capturing at the endpoint, frames larger than the MTU appear because of segment offload features such as TSO/GSO, and “incorrect checksum” warnings because of checksum offload. These aren’t network problems; they’re the result of the capture being taken before the driver. This is usually a beginner’s first false alarm.
Cisco SPAN session configuration example
The example below copies a server port’s traffic in both directions, on a Cisco Catalyst, to the port the analysis computer is connected to:
monitor session 1 source interface GigabitEthernet1/0/10 both
monitor session 1 destination interface GigabitEthernet1/0/48
!
show monitor session 1
The destination port loses its normal switching function for the duration of the session. If you accidentally choose the uplink as the destination, you cut the connection yourself; read the port number twice before entering the command. RSPAN is used to carry traffic from a remote switch to the central analysis point:
! On both switches and on the trunks in between
vlan 999
remote-span
!
! Source switch
monitor session 2 source interface GigabitEthernet1/0/5 both
monitor session 2 destination remote vlan 999
!
! Switch the analysis point is connected to
monitor session 2 source remote vlan 999
monitor session 2 destination interface GigabitEthernet1/0/48
Capture filter and display filter examples
Wireshark has two separate filter languages, and mixing them up is the most common mistake. The capture filter uses BPF (libpcap) syntax and is applied during capture; a packet left out is never recorded. The display filter is Wireshark’s own syntax and narrows the view on a recorded trace. On long-running or busy links, a capture filter protects disk and CPU. For short captures with an unclear target, capture broadly and narrow down with a display filter.
| Purpose | Capture filter (BPF) | Display filter |
|---|---|---|
| A single host | host 10.10.20.15 |
ip.addr == 10.10.20.15 |
| DNS traffic | port 53 |
dns |
| DHCP traffic | udp port 67 or udp port 68 |
dhcp |
| Excluding the SSH session | not port 22 |
!(tcp.port == 22) |
| New TCP connections | tcp[tcpflags] & (tcp-syn|tcp-ack) == tcp-syn |
tcp.flags.syn == 1 && tcp.flags.ack == 0 |
In older Wireshark versions the DHCP display filter was bootp; from 3.0 onward dhcp is used. For the full list of field names, the Wireshark documentation and the display filter reference are the primary source.
Reading TCP problems: retransmission, zero window, RTT
Wireshark tracks TCP sequence and acknowledgment numbers and flags anomalies with tcp.analysis fields. The fastest start is the tcp.analysis.flags filter; then the flags are read one by one:
tcp.analysis.retransmissionandtcp.analysis.fast_retransmission: The segment didn’t reach the other side or its acknowledgment didn’t come back. In which direction and at which capture point the retransmission is seen narrows down the location of the loss.tcp.analysis.duplicate_ack: The receiver got an out-of-order segment and is asking for the missing one; this is usually the first sign of loss.tcp.analysis.zero_window: The receiver’s receive buffer is full and it’s telling the sender to “stop.” This usually points not to the network but to the receiving application or server not reading data fast enough.tcp.analysis.window_full: The sender used the entire window advertised by the receiver; on high-latency links, a small window size limits throughput.
To separate the source of delay, two measurements are read together. Network RTT comes from the three-way handshake: Wireshark gives the time between the SYN and the ACK completing the handshake in the tcp.analysis.initial_rtt (iRTT) field. In a trace taken on the client side, the time between SYN and SYN/ACK is the delay of the path from client to server. Application response time is the time between the client’s request and the server’s first data response. If the handshake completes in a few milliseconds but the server responds to each request seconds later, the problem isn’t in the network infrastructure but in the server or application. This distinction closes the “it’s on your side” debate with evidence. A screenshot is enough.
A typical field scenario: a file copy is slow, the trace taken on the server side shows frequent tcp.analysis.zero_window, and there are no retransmissions. The server is stuck on disk write or processing speed. Upgrading the link doesn’t change the result.
Analyzing DNS and DHCP flows
DNS delay shows up to the user as “the application hangs while opening” and is often blamed on the network. Wireshark adds the time between each DNS response and its query in the dns.time field. Useful filters:
dns.time > 0.5 # responses taking longer than half a second
dns.flags.rcode != 0 # error responses such as NXDOMAIN, SERVFAIL
dns.flags.response == 0 && !dns.response_in # queries that never got a response
A query that gets no response causes the client to fall back to the second DNS server and wait for the timeout. For enterprise resolver design and internal/external namespace separation, see the enterprise DNS architecture article.
The normal DHCP flow is the sequence Discover, Offer, Request, ACK (DORA). The message type is in the dhcp.option.dhcp field: 1 Discover, 2 Offer, 3 Request, 5 ACK, 6 NAK. If the trace has only Discover and no Offer arrives, the places to look are the relay configuration, the DHCP snooping trust setting and access to the server. One possible cause of this picture is a newly added uplink not being marked trusted in snooping. If an Offer is visible but the client doesn’t send a Request, you move to the client side. Relay and snooping configuration errors are covered in detail in the DHCP relay and DHCP snooping article. For clients behind a relay, in the server-side trace packets arrive as unicast not from the client but from the relay agent’s IP address, and the giaddr field is filled; to find the client in the trace, search for its MAC address in the chaddr field.
Long-running ring buffer capture with tshark
Intermittent problems don’t show up when someone opens Wireshark. In such cases a capture that “waits” for the problem is set up: tshark (or dumpcap directly) writes files of a set size and rotates within a fixed disk space by deleting the oldest file. When the problem occurs, the files for the relevant time window are preserved.
# 50 files of 100 MB: at most about 5 GB of disk
tshark -i eth1 -f "host 10.10.20.15" \
-b filesize:102400 -b files:50 \
-w /data/capture/srv15.pcapng
# If headers are enough, keep 128 bytes per packet
dumpcap -i eth1 -s 128 -b filesize:102400 -b files:50 -w /data/capture/hdr.pcapng
# Command-line analysis on a recorded trace
tshark -r srv15_00012_<time>.pcapng -Y "tcp.analysis.retransmission" \
-T fields -e frame.time -e ip.src -e ip.dst -e tcp.stream
tshark -r srv15_00012_<time>.pcapng -q -z conv,tcp
tshark -r srv15_00012_<time>.pcapng -q -z io,stat,60
The filesize value is in kilobytes; tshark adds a sequence number and timestamp to the name of each file in the ring buffer. The analysis machine’s clock must be synchronized with NTP. If the problem time reported by the user and the trace timestamp don’t match, finding the right file takes hours.
Privacy and retention considerations
With unencrypted protocols, a packet trace can contain usernames, email contents and personal data. A capture starts with an authorization and proceeds within limits:
- The purpose, scope (host/port) and duration of the capture are written into the change or incident record.
- Where possible, the scope is narrowed with a capture filter and the payload is cut with snaplen.
- Trace files are kept in a directory with restricted access and deleted when the analysis is done; if they’ll be sent outside (vendor support, etc.), they’re anonymized or trimmed first.
- For personal data processing, the organization’s policy and KVKK (Turkish Personal Data Protection Law) obligations are taken into account.
For choosing the capture point, analyzing traces and reporting findings in complex performance problems, you can get support from our network performance analysis and troubleshooting service.
Frequently asked questions
Is packet loss seen in a trace captured with SPAN real?
Not always. If the total traffic of the source ports exceeds the destination port’s capacity, the switch drops mirrored copies and false loss appears in the trace. To verify real loss, capture the same session at the endpoint or from a second point with a TAP and compare.
Should I use a capture filter or a display filter?
On busy links and in long captures, a capture filter reduces disk and CPU load, but a packet left out doesn’t come back. If the target is unclear, it’s safer to capture broadly and narrow down with a display filter.
Does seeing a zero window indicate a network problem?
Usually not. A zero window shows that the receiver’s buffer is full and the application can’t read the data fast enough. The problem is mostly on the receiving server, disk or application side.
Is Wireshark useful with encrypted traffic?
Yes. In TLS-encrypted traffic the application content isn’t visible, but the TCP handshake, retransmissions, window sizes, delays and the TLS handshake are. These are often enough to diagnose network-related problems.