Network Troubleshooting for Beginners: Listening to the Wires
Published on September 17, 2025
Network Troubleshooting for Beginners: Listening to the Wires
Introduction
Imagine: ping
works, DNS responds, ports are open, mtr
shows no loss, but curl
returns errors like connection reset by peer or SSL handshake failed. There’s clearly a problem, but standard tools are powerless.
At such moments, the only option is to look at the actual traffic — in other words, “listen to the wires.” This process is called packet sniffing or packet analysis. In this article, we’ll go through how to use three key tools: tcpdump
, sngrep
, and Wireshark
.
tcpdump
— The Ear of Your Server 👂
tcpdump
is the de facto standard for capturing packets on Unix systems. It shows “raw” data directly in the console and can write dumps to a file for further analysis in Wireshark.
How to use tcpdump
List interfaces:
sudo tcpdump -D
This is important if the server has multiple network cards.
Capture traffic for a specific host:
sudo tcpdump -i eth0 host 8.8.8.8
Filter by port and protocol:
sudo tcpdump -i eth0 tcp port 443
Save dump for Wireshark:
sudo tcpdump -i eth0 -w /tmp/capture.pcap
Limit size or duration of capture:
# Capture only the first 1000 packets sudo tcpdump -i eth0 -c 1000 # Create a new file every minute (-G) and save the full packet (-s 0) sudo tcpdump -i eth0 -s 0 -w /tmp/capture-%Y-%m-%d_%H:%M:%S.pcap -G 60
⚡ Tip:
-c
and-G
help avoid flooding the disk with dumps during long diagnostics.
sngrep
— Dialogues in the Terminal 🗣️
sngrep
was originally created for VoIP (SIP) but can also display other TCP/UDP sessions. Its main convenience is grouping packets into dialogs.
How to use sngrep
Install:
sudo apt update && sudo apt install -y sngrep
Run with privileges:
sudo sngrep
Navigation:
- Arrows — select session.
Enter
— view dialog details./
— search by IP or port number.
Filter SIP calls:
sudo sngrep port 5060
⚡ Useful when you need to quickly debug SIP registration, INVITE, or HTTP sessions without diving into the “raw” tcpdump output.
Wireshark — The Network Microscope 🔬
Wireshark is a GUI packet analyzer and the gold standard for in-depth network investigation.
How to use Wireshark
Open a saved dump:
wireshark /tmp/capture.pcap
Display filters:
- Only HTTP requests:
http.request
- Only TLS handshakes:
tls.handshake
- Only HTTP requests:
Follow TCP Stream — collect packets from a single connection and show the full dialog (handy for HTTP, SMTP, and even binary protocols).
Coloring rules — highlight packets based on conditions (e.g., show TCP-reset in red).
⚡ Important: capture filters (
port 443
) are set during capture (e.g., in tcpdump), while display filters (tls.handshake
) are applied only when analyzing an already captured dump.
⚡ If working over SSH, you can write a tcpdump capture file on the server, then download it and open it in Wireshark.
Tool Comparison
Tool | Features | How to use |
---|---|---|
tcpdump | Fast CLI capture, works anywhere | On servers without GUI, for quick diagnostics |
sngrep | Groups packets into dialogs | SIP, HTTP, DNS — when you need to see communication as a conversation |
Wireshark | Deep GUI analysis | Local work, complex cases, visualization |
Checklist of Common Beginner Mistakes ⚠️
- Running
tcpdump
orsngrep
withoutsudo
→ interface access will be restricted. - Saving dumps without the
-s 0
option → packets are truncated by default (usually 96 bytes). - Mixing up capture filter (tcpdump/BPF) and display filter (Wireshark).
- Capturing without limits (
-c
or-G
) → disk gets filled with gigabytes of data. - Opening a pcap file in a text editor instead of Wireshark.
- Trusting only headers (
flags
,handshake
) and forgetting to check the payload. - Thinking
tcpdump
automatically shows DNS names — but it can slow down analysis (better use-n
to disable resolving).
Conclusion
Network traffic analysis is a deep dive at the highest level. When standard checks don’t provide answers, packet sniffers let you:
- see what’s really happening “on the wire”;
- verify correctness of handshakes, timings, and dialogs;
- find the culprit: server, client, NAT, firewall, or network.
To master these tools, you need practice. Try:
- Capturing your own HTTP traffic.
- Observing how a DNS query works.
- Analyzing a TLS handshake.
Only through practice will you realize how useful it is to “listen to the wires.”
Related Posts
Jitsi Meet vs Google Meet: when full control over data matters most
September 7, 2025
073 | Introduction to Virtualization: Why It’s Needed and How It Saves Time
August 4, 2025
065 | Why Network Resilience Is Not a Luxury, but a Necessity
July 27, 2025
059 | Loki + Grafana: A Lightweight and Cost-Effective Logging Solution for the Cloud
July 21, 2025