Wireshark: how to capture and read network traffic safely
2 min readNetworking · Security · Tools · Guides
Wireshark is a free, open-source packet analyzer. It records the traffic passing through a network interface and decodes it, packet by packet, into protocols you can read. It is the standard tool for answering what your machine is actually sending, and for debugging DNS, TLS handshakes, slow TCP connections and odd firewall behavior. It is also easy to misuse, so the first rule comes before the first capture: only capture networks and devices you own or have written permission to test.
What it actually is
- A GUI on top of a capture engine: libpcap on Linux and macOS, Npcap on Windows.
- Dissectors for a very large number of protocols, so a raw frame becomes Ethernet, IP, TCP, TLS, HTTP and so on.
- Two filter languages: capture filters limit what is recorded, display filters limit what you see.
- tshark, the command-line sibling, for servers and scripts.
- Free software under the GPL.
Your first useful capture
Pick the interface that carries your traffic, start the capture, do the thing you want to inspect, then stop. Keep captures short. Then narrow the view by typing display filters into the bar at the top.
dns
ip.addr == 192.168.1.10
tcp.port == 443
tcp.flags.syn == 1 && tcp.flags.ack == 0
tls.handshake.type == 1
tcp.analysis.retransmission- dns shows name lookups, the first place to look when something cannot be reached.
- ip.addr limits the view to one host.
- SYN without ACK shows new connection attempts only.
- tls.handshake.type == 1 shows the TLS Client Hello, where the server name usually appears.
- tcp.analysis.retransmission highlights packets Wireshark thinks were resent, a clue to loss or congestion.
Capture filters are different
Capture filters use BPF syntax and apply before packets are stored, which saves disk and memory on busy links. You cannot change them mid-capture, so be conservative.
# capture filter (BPF), entered before you start
host 192.168.1.10 and port 53
# the same idea on the command line
tshark -i eth0 -f "port 53" -w dns.pcapngWhere it bites
- Encrypted traffic stays encrypted. For HTTPS you see addresses, timing and the handshake, not the page. For your own browser traffic you can set the SSLKEYLOGFILE environment variable and load that key log in Wireshark. That is a debugging feature, not a way into anyone else's sessions.
- Wi-Fi is awkward. Seeing other devices' frames needs monitor mode, which many adapters and operating systems restrict.
- Switches limit what you see. On a normal switched network you will not see other hosts' unicast traffic.
- Loopback on Windows is captured through Npcap. Localhost traffic does not show on an ordinary adapter.
- Captures contain secrets. A capture file can hold passwords for unencrypted protocols and session tokens. Treat it like a credential before you share it.
Verdict
Wireshark teaches networking faster than any book, because you can watch the protocols do their work. Capture small, filter early, and keep the permission rule in mind. When the traffic is encrypted, look at the metadata and reason from there instead of fighting the encryption.
Download and docs: wireshark.org

Written by
Shihab Hossain — Full-Stack Developer
I build thoughtful digital products from Bangladesh — fast web experiences with Next.js, Android apps with Flutter, and the infrastructure behind them.
Work with me