Network security

How to Use Wireshark: Capture, Filter and Inspect Packets

Wireshark turns invisible network traffic into readable packets. Here is how to capture, filter and inspect traffic on networks you own or are allowed to test.

Cysoro Security TeamPublished · 8 min read
No. Time Protocol1 0.0001 DNS2 0.0042 TCP3 0.0098 TLS4 0.0120 HTTP5 0.0203 DNSfilter: dns NETWORK SECURITY How to useWireshark Capture, filter, inspect — step by step.
Quick answer

To use Wireshark, install it from wireshark.org, pick the network interface carrying the traffic you want to study, double-click it to start capturing, then use a display filter such as dns or tcp.port == 443 to narrow the results. Click any packet to inspect its protocol layers, and use Follow TCP Stream to rebuild a whole conversation. Only capture traffic on networks you own or have permission to analyze.

Key takeaways

  • Capture filters decide what gets recorded; display filters only hide packets from view, so choose the right one before you start.
  • Start with a short capture and a simple filter such as dns, then narrow down to the conversation you actually need.
  • Only capture traffic you are allowed to see — on your own network, a lab, or with written permission.

Wireshark is the tool network engineers reach for when a connection misbehaves and nobody knows why. It captures the packets travelling over your network and lays them out so you can read them — which DNS lookup failed, which server never answered, and what exactly your computer said to the internet.

What is Wireshark?

Wireshark is a free, open-source network protocol analyzer. It captures packets from a network interface and displays their contents in detail, from the Ethernet frame up through IP, TCP and the application protocol such as DNS or HTTP.

It runs on Windows, macOS and Linux, and it is released under the GNU General Public License, so you can use it free of charge. On Windows it uses Npcap, the packet-capture driver bundled with the installer; the older WinPcap driver is no longer supported. Download it only from the official site, wireshark.org, never from a third-party download portal.

People use Wireshark to troubleshoot slow networks, find devices that are flooding a network, verify that a firewall rule works, and learn how protocols behave in practice. It is also a standard tool in security training and incident response, because a packet capture is often the most direct evidence of what actually happened on a network.

Only capture what you are allowed to seeCapture traffic on your own network, a lab, or a network where you have written permission. Capturing other people's traffic without permission can break the law and your employer's policies. Keep captures short and delete them when you are done.

How do I install Wireshark?

Download the installer for your operating system from wireshark.org and follow the prompts. On Linux, install it from your distribution's package manager, and add your user to the capture group so you do not have to run Wireshark as root.

  1. Windows: run the official installer and accept the Npcap component. Restart if the installer asks you to.
  2. macOS: download the disk image from wireshark.org, drag Wireshark to Applications, and install the ChmodBPF component so non-admin users can capture.
  3. Linux: install from your package manager, for example sudo apt install wireshark on Ubuntu or Debian. During setup, choose to allow non-superusers to capture.
  4. Check it works: open Wireshark and confirm your Wi-Fi or Ethernet interface appears on the welcome screen.

If no interfaces appear, you usually have a permissions problem: on Linux, check that your user is in the wireshark group; on Windows, reinstall Npcap. You can check your own public address first with our free IP checker so you know what to look for in the capture.

How do I start my first capture?

Open Wireshark, find the interface carrying the traffic you want to study — usually Wi-Fi or Ethernet — and double-click it. Wireshark starts capturing immediately, and packets appear in the list in real time.

The welcome screen shows a small traffic graph beside each interface, which helps you spot the active one. You can also select an interface and choose Capture, then Start, or click the shark-fin button in the toolbar. To capture from the command line instead, run wireshark -i eth0 -k, replacing eth0 with your interface name.

For a first exercise, keep it short and deliberate:

  1. Start a capture on your active interface with no capture filter.
  2. Generate one known request: in a terminal, run nslookup example.com to make a DNS lookup.
  3. Stop the capture after a few seconds using the red square button. Short captures are easier to review and contain less unrelated data.
  4. Filter for DNS by typing dns in the display-filter bar and pressing Enter.

You should now see the DNS query for example.com and the answer that came back. That loop — capture, generate traffic, stop, filter — is the core of almost all Wireshark work.

The Wireshark window, in three panes1. Packet listEvery packet, one row each: time, source, destination, protocol, length, summary2. Packet detailsThe selected packet broken into layers: Ethernet, IP, TCP, then DNS, HTTP or TLS3. Packet bytesThe raw bytes of the selected packet, in hexadecimal — click a field above to highlight it here
Three panes, one packet: the list shows what happened, the details show why, and the bytes show the raw evidence. Illustration by Cysoro.

What is the difference between capture filters and display filters?

Capture filters and display filters do different jobs at different times, and mixing them up is the most common beginner mistake. A capture filter decides what gets recorded; a display filter only decides what you see.

Capture filterDisplay filter
When it runsWhile packets arriveAfter packets are captured
Syntaxlibpcap (BPF) syntaxWireshark filter syntax
Exampletcp port 443tcp.port == 443
Rejected packetsDiscarded foreverHidden, but still in the file
Where you set itCapture Options dialogFilter bar at the top
Use it whenYou know exactly what you need and want small filesYou are exploring a capture you already have

Beginners should usually leave the capture filter blank and use display filters instead. That way, if your first guess was wrong, the packets are still there. Set a capture filter only when you know the traffic will be huge — for example, capturing on a busy server — and you need to keep the file small.

Capture filters use the libpcap language: host 192.0.2.10 and port 443 keeps only traffic for that host on port 443. Display filters are protocol-aware: ip.addr == 192.0.2.10 shows packets to or from that address, and http.request shows only HTTP requests.

Which display filters should I learn first?

A handful of display filters covers most everyday troubleshooting. Type one in the filter bar and press Enter; a green background means the filter is valid, and red means it has a syntax error.

GoalDisplay filter
Show DNS trafficdns
Show HTTP requestshttp.request
Show traffic for one hostip.addr == 192.0.2.10
Show TCP packets on port 443tcp.port == 443
Show TCP connection startstcp.flags.syn == 1
Show failed DNS lookupsdns.flags.rcode != 0
Show TLS handshakestls.handshake
Exclude your own noise!ip.addr == 192.0.2.10

Combine filters with and, or and not: tcp.port == 443 and ip.addr == 192.0.2.10 shows only HTTPS traffic for one host. Use the Expression button beside the filter bar to build filters by picking a protocol field instead of typing from memory.

Capture filter vs display filterCapture filterlibpcap syntax: tcp port 443runs while packets arriverejected packets are goneSet before you startDisplay filterWireshark syntax: tcp.port == 443runs after capturehidden packets stay in the fileSafe for beginnersWhen in doubt, leave the capture filter blank and filter after.
Capture filters discard packets forever; display filters only hide them. Illustration by Cysoro.

How do I inspect a packet?

Click any packet in the list and read it from the top down. The details pane breaks it into layers: the Ethernet frame, the IP header with source and destination addresses, the TCP or UDP header with ports and flags, and then the application data.

Start with the summary column in the packet list — it tells you the protocol and the key fact, such as a DNS query name or an HTTP request line. Then expand the layers that matter: for a DNS problem, expand the DNS section and check the query name and the response code; for a slow website, look at the TCP section and check for retransmissions, which show up as black packets with a note in the summary.

Two features make inspection much easier. First, right-click a TCP packet and choose Follow, then TCP Stream, to rebuild the whole conversation in order. Second, use Analyze, then Expert Information, to see Wireshark's own summary of errors, warnings and unusual packets in the capture.

What are the most useful Wireshark tasks?

Most real Wireshark work is one of a few repeated jobs. Learn these and you can handle the majority of network problems you will meet.

Check whether DNS is working

Filter with dns and look for queries with no matching response, or responses with an error code. A query that never gets an answer points at a DNS server or firewall problem, not at the website. Our free DNS lookup tool gives you the expected answer to compare against.

Find why a connection is slow

Filter for the host with ip.addr == 192.0.2.10, then look at the time column and the TCP retransmissions. Long gaps between a request and its response, or many retransmitted packets, usually mean packet loss or a congested path.

Check a TLS handshake

Filter with tls.handshake and look for the Client Hello, Server Hello and certificate. If the handshake fails, the alert packet tells you why — for example, an expired certificate or a protocol version the server rejects.

Summarize a capture

Use Statistics, then Protocol Hierarchy, to see which protocols dominate the capture, and Statistics, then Conversations, to see which pairs of hosts exchanged the most traffic. This is the fastest way to find a device flooding the network.

How do I use Wireshark from the command line?

TShark is Wireshark's command-line twin, and it is the right tool for servers, scripts and remote sessions where no graphical interface exists. It uses the same capture engine and the same display-filter language, as documented in the official tshark manual page.

  • tshark -D — list the interfaces you can capture on.
  • tshark -i eth0 -c 100 — capture 100 packets on eth0 and print a summary of each.
  • tshark -i eth0 -w capture.pcapng — save a capture to a file for later analysis in Wireshark.
  • tshark -r capture.pcapng -Y dns — read a saved file and show only DNS packets.
  • dumpcap -i eth0 -w capture.pcapng — capture with the lightweight dumpcap tool, which Wireshark itself uses under the hood.

Save captures in the pcapng format, which is Wireshark's native format and preserves interface names and comments. Keep capture files small: a few thousand packets is usually enough to diagnose a problem, and a large capture full of other people's traffic is a privacy risk.

What mistakes should beginners avoid?

The biggest mistake is capturing everything for hours and then drowning in packets. Capture for seconds or minutes, with a clear question in mind, and stop as soon as you have the traffic you need. The second mistake is setting a capture filter too early and discarding the packets that would have answered the question.

Other common mistakes: running Wireshark as root when your user could capture with the right group membership, and forgetting that a display filter hides packets rather than deleting them.

Sharing a capture file without checking what it contains is another risk. A capture can include passwords sent in plain text, session cookies and personal data, so treat capture files as sensitive and delete them when the job is done. If you are securing the network you just analyzed, our guide to how to secure your Wi-Fi is a good next step.

The bottom line

Wireshark rewards a simple routine: capture briefly, filter with a clear question, and read the packet from the top down. Learn the difference between capture and display filters, keep dns, ip.addr and tcp.port in your pocket, and use Follow TCP Stream whenever a single packet is not enough.

Start on your own network with a 10-second capture and one DNS lookup. Once that feels easy, try a TLS handshake and a slow-connection investigation — and check your results against our free DNS lookup tool before you draw conclusions.

Frequently asked questions

What is Wireshark used for?

Wireshark is a free, open-source network protocol analyzer. It captures packets travelling over a network and shows their contents in a readable form, so you can troubleshoot slow connections, find misconfigured devices, and learn how protocols such as DNS, HTTP and TLS actually work.

Is Wireshark free?

Yes. Wireshark is released under the GNU General Public License, which means you can use it and its source code free of charge. Download it only from wireshark.org, and on Windows it installs Npcap, the packet-capture driver it needs.

Is it legal to use Wireshark?

It is legal to capture traffic on a network you own or have permission to analyze, such as your home network or a lab. Capturing other people's traffic without permission can break the law and your employer's policies, so get written permission first and keep captures short.

What is the difference between a capture filter and a display filter?

A capture filter uses libpcap syntax, such as tcp port 443, and decides which packets are recorded at all. A display filter uses Wireshark syntax, such as tcp.port == 443, and only hides packets from the current view. Packets rejected by a capture filter are gone forever.

How do I filter Wireshark by IP address?

Use ip.addr == 192.0.2.10 to show packets to or from that address, ip.src == 192.0.2.10 for packets sent by it, and ip.dst == 192.0.2.10 for packets sent to it. Replace the address with the one you are investigating.

How do I follow a TCP stream in Wireshark?

Right-click any TCP packet in the conversation and choose Follow, then TCP Stream. Wireshark rebuilds the whole exchange in order, which is far easier to read than individual packets, especially for HTTP requests and responses.

Can Wireshark decrypt HTTPS traffic?

Wireshark cannot decrypt TLS traffic by default, and that is by design. You can decrypt your own traffic if you have the session keys, for example by setting the SSLKEYLOGFILE environment variable in your browser, but you cannot decrypt someone else's encrypted traffic.

What is tshark?

TShark is Wireshark's command-line twin. It captures and analyzes packets without a graphical interface, which makes it ideal for servers, scripts and remote work. For example, tshark -i eth0 -c 100 saves or shows the first 100 packets on the eth0 interface.

Sources

  1. Wireshark — User's Guide: Capture Options
  2. Wireshark — User's Guide: Start Wireshark from the command line
  3. Wireshark — tshark manual page
  4. AndroidExperto — How to Use Wireshark to Capture, Filter and Inspect Packets
  5. SecByte — Wireshark Tutorial: Network Traffic Analysis
Written & fact-checked byCysoro Security Team

The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.

  • Email authentication
  • Phishing & BEC
  • Domain & DNS security
  • Small-business security

Checked against the official Wireshark User's Guide and tshark manual pages, plus current tutorial coverage of Wireshark 4.x.

How we write and fact-check →

Free tools for this topic

No account needed.

See where your domain stands

Free for up to 3 domains. No card, no installs.

Start free