Tutorials · Troubleshooting
How to Capture and Read Network Traffic With Wireshark and tcpdump
When logs are not enough, look at the packets. Capture traffic with tcpdump or Wireshark, filter it down to the problem, and spot retransmissions, DNS failures, DHCP issues and TLS errors.
Before you start
- Wireshark on your laptop (free, wireshark.org)
- tcpdump on Linux servers (usually installed)
- A port mirror (SPAN) on the switch if you need to capture traffic of other devices
- Permission to capture: packet captures can contain personal data
Step by step
Decide where to capture
Capture as close to the problem as possible: on the affected client, on the server, or on a switch mirror port that copies the traffic of the device you are investigating.
Capture on a server with tcpdump
Limit the capture to the hosts and ports you care about, and write it to a file you can open in Wireshark.
sudo tcpdump -i eth0 -nn -s 0 host 10.1.10.50 and port 443 -w /tmp/case123.pcap # stop with Ctrl+C, then copy the file to your laptop
Use a ring buffer for intermittent problems
If the fault happens once an hour, capture continuously into rotating files so the disk never fills.
sudo tcpdump -i eth0 -nn -w /var/tmp/cap.pcap -C 100 -W 20 host 10.1.10.50 # 20 files of 100 MB, oldest overwritten
Filter in Wireshark
Display filters narrow millions of packets to the few that matter.
ip.addr == 10.1.10.50 tcp.port == 443 dns && dns.flags.rcode != 0 # DNS errors dhcp # DHCP (older versions: bootp) tcp.analysis.retransmission # lost/resent segments tcp.analysis.zero_window # receiver overloaded tls.alert_message # TLS failures
Follow one conversation
Right-click a packet > Follow > TCP Stream to see one connection from start to end. Check the handshake: SYN, SYN-ACK, ACK. A SYN with no answer means a firewall or routing problem; a RST means the server refused.
Read the timing
Statistics > Conversations shows bytes and duration per pair. Set View > Time Display Format > Seconds Since Previous Displayed Packet to find long gaps: a slow server answer looks very different from network loss.
Share safely
Trim the capture to the relevant packets (File > Export Specified Packets) before sending it to a vendor. Delete captures when the case is closed.
Commands are generic, industry-standard examples. Exact syntax and menu names vary by model and firmware; check your device's manual on the Documentation page.
Pro tips
- Capture filters (tcpdump syntax) reduce what is saved; display filters (Wireshark syntax) only hide packets. Use capture filters on busy links.
- Many retransmissions on one switch port often mean a bad cable or duplex mismatch: check the port error counters.
- Encrypted traffic (HTTPS) still shows handshakes, timing and errors even when you cannot read the content.
FAQ
Frequently asked questions
Can I capture Wi-Fi traffic?
Capture on the client or on the wired side of the access point. Capturing raw 802.11 frames needs an adapter that supports monitor mode.
Is it legal to capture traffic?
On your own network for troubleshooting, generally yes, but captures may contain personal data. Follow your company policy and data protection law, limit scope and delete files afterwards.
Keep learning
Related guides
Use port mirroring
Read more →Troubleshoot DNS with dig
Read more →Ping, traceroute and MTR
Read more →How to Troubleshoot Network Problems With Ping, Traceroute and MTR
Find where a connection breaks or slows down in minutes. Use ping for reachability and loss, traceroute for the path, and MTR to see loss and latency on every hop at once.
Read more →How to Test Network Speed Between Two Points With iperf3
Internet speed tests do not tell you how fast your LAN, Wi-Fi or site-to-site link really is. iperf3 measures throughput, loss and jitter between two machines you control.
Read more →How to Troubleshoot DNS Problems With dig and nslookup
'The Internet is down' is often DNS. Learn to check which DNS server a device uses, query records directly, compare answers and clear caches.
Read more →Stuck on a step?
Ask Navijin technical support or an authorised partner for help with your configuration.