Free tech learning for everyone, from basics to pro

Cyber Security LabsLabsBeginner

Lab: capturing and reading traffic with Wireshark

In short: Wireshark shows you exactly what is on the wire. In this lab you capture traffic from your own computer, filter it, and read a complete web visit from ARP and DNS through the TCP handshake to the start of a TLS session.

Aim and what you need

The aim is to build the core skill of packet analysis: capturing the right traffic and recognising common protocols. You will use it for troubleshooting, security investigations and exams.

  • Wireshark (free, open source) on your own Windows, macOS or Linux machine, or on a VM in your isolated lab.
  • Permission: capture only on networks and devices you own or are authorised to monitor. Captures can contain personal data, cookies and sometimes passwords, so store and share them carefully.

Filters and what to look for

Two kinds of Wireshark filterCapture filter (BPF)Set before capturingDecides what is savedSyntax: port 53Smaller filesDisplay filterSet any timeHides, never deletesSyntax: dnsRich protocol fields
Figure 1. Capture filters limit what is recorded; display filters only change what you see in an existing capture.
Reading a web visitARPfind gatewayMACDNSname to IPTCPthree-wayhandshakeTLSClient HelloDataencryptedrecords
Figure 2. A typical HTTPS visit in a capture: address resolution, name lookup, TCP handshake, TLS negotiation, then encrypted data.
Display filterShows
arpAddress Resolution Protocol requests and replies
dnsName lookups and answers
tcp.flags.syn == 1 && tcp.flags.ack == 0The first packet of each new TCP connection
tls.handshake.type == 1TLS Client Hello messages (with the server name)
ip.addr == 192.168.10.20All traffic to or from one host
tcp.analysis.flagsRetransmissions and other TCP problems

Steps

  1. Install Wireshark. On Linux, allow your user to capture without running the whole program as root, then log out and in again.
  2. List interfaces and pick the one that carries your traffic (usually Wi-Fi or Ethernet).
  3. Start a capture, then generate traffic: clear the ARP cache if you can, look up a name and open a website.
  4. Stop the capture after about 30 seconds and save it as lab-web.pcapng.
  5. Apply each display filter from the table and find the packets in Figure 3. Right-click a TCP packet and choose Follow, TCP Stream.
  6. Open Statistics, Conversations and Statistics, Protocol Hierarchy to see the big picture.
sudo apt install wireshark
sudo usermod -aG wireshark $USER
tshark -D
tshark -i eth0 -f "port 53 or port 443" -a duration:30 -w lab-web.pcapng
nslookup example.com
curl -I https://example.com
tshark -r lab-web.pcapng -Y "dns" -T fields -e dns.qry.name
tshark -r lab-web.pcapng -Y "tls.handshake.type == 1" -T fields -e tls.handshake.extensions_server_name

On Windows, run arp -d * from an administrator prompt before browsing to see fresh ARP traffic; on Linux use sudo ip neigh flush all.

Verify, troubleshoot and clean up

Success means you can point to: an ARP request and reply for your gateway; a DNS query and answer for example.com; a SYN, SYN-ACK, ACK sequence; and a TLS Client Hello showing the server name, after which the data is unreadable because it is encrypted. Write down the source port of your connection and find it in all three TCP packets.

  • No interfaces listed: the capture driver (Npcap on Windows) is missing, or on Linux your user is not yet in the wireshark group.
  • Only your own traffic on Wi-Fi: that is normal. Switches and Wi-Fi only deliver frames meant for you; seeing other hosts needs a mirror (SPAN) port on a switch you manage.
  • Capture is huge: use a capture filter or a duration limit next time.
  • Names show as raw IPs: name resolution is off in View, Name Resolution, which is usually what you want.

Clean up by deleting captures you no longer need, especially any that contain logins or personal data. Use the port lookup tool to identify unfamiliar port numbers you see.

Practice

What is the difference between a capture filter and a display filter?
A capture filter limits what is recorded at all; a display filter only hides packets in an existing capture and can be changed at any time.
Which three TCP packets make up the handshake?
SYN from the client, SYN-ACK from the server, and ACK from the client.
Why can you still see the website name in HTTPS traffic?
The client usually sends the server name in clear text in the TLS Client Hello (the SNI extension), unless Encrypted Client Hello is used.

Key takeaways

  • Capture only on networks and devices you own or are authorised to monitor.
  • Capture filters decide what is saved; display filters decide what is shown.
  • A web visit shows ARP, DNS, the TCP handshake and a TLS Client Hello.
  • tshark is the command-line version, handy for scripts and servers.
  • Treat capture files as sensitive data and delete them when done.
Tracks your learning on this device only. See your progress on the learning paths.

About the author

Mohamed Fayas

Founder of FM TecHub. CCNA certified, with a BTEC HND in Network Engineering, and BEng (Hons) in Computer Networking and Cloud Security. He writes practical, plain-English guides on networking, security and cloud.

More about the author

Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.

Stay up to date by email

New notes, tools and security news from FM TecHub, explained simply. Free.

We only use your email to send these updates. See our privacy policy.