Skip to content
Dorian FINKEL
tcpdumpTroubleshootingWiresharkTutorial · 2026 · 2 min read · Updated 9 October 2026
Level · BeginnerDuration · 20 min

Troubleshoot the network with tcpdump

When “it doesn’t work”, look at what really goes over the wire. tcpdump captures, filters, and sets things up for Wireshark, including live from a remote server.

Prerequisites

  • Root access on the machine where you capture

01Options to know

-i picks the interface (any for all, on Linux); -nn shows addresses and ports without name resolution, faster and more readable; -c stops after a number of packets; -v gives more detail; -w writes to a file, -r reads it back; -A prints the content as text, handy for clear-text HTTP or DNS.

02Filter

Filters combine host, net, port with and, or and not. Quote them as soon as they get complex. You can also filter on TCP flags, for example to see only connection attempts.

Example · Shell
# Everything involving one host
tcpdump -i eth0 -nn host 192.168.10.20

# DNS queries
tcpdump -i eth0 -nn port 53

# HTTPS, except with the gateway
tcpdump -i eth0 -nn 'tcp port 443 and not host 192.168.10.1'

# A whole subnet
tcpdump -i eth0 -nn net 192.168.20.0/24

# SYNs only (connection attempts)
tcpdump -i eth0 -nn 'tcp[tcpflags] & tcp-syn != 0 and tcp[tcpflags] & tcp-ack == 0'

03Capture for Wireshark

On a headless server, capture to a file, bring it back, and open it in Wireshark to follow the exchanges at leisure.

Or live: tcpdump writes to its standard output, carried over SSH to the workstation’s Wireshark. -U sends each packet immediately; the filter excludes SSH itself, otherwise the capture captures itself.

Example · Shell
tcpdump -i eth0 -nn -c 1000 -w capture.pcap 'port 443'
tcpdump -nn -r capture.pcap | head

# Live, from the server to the workstation's Wireshark
ssh root@server "tcpdump -i eth0 -U -w - 'not port 22'" | wireshark -k -i -

04Reading the result

A SYN with no SYN-ACK back: the packet leaves but the reply doesn’t return (firewall, return route). An immediate RST: the port is closed on the target, or a firewall actively rejects. No packet at all: it doesn’t even reach the interface, the problem is upstream.

Key takeaways

  • -nn every time.
  • host, net, port + and/or/not, and TCP flags when needed.
  • -w to analyse later in Wireshark, or live over SSH.
  • Unanswered SYN, RST, nothing at all: three different diagnoses.

Example addresses.

Official sources