Free tech learning for everyone, from basics to pro

IoT LabsLabsIntermediate

Lab: capturing and analysing IoT traffic

In short: IoT devices cannot run capture tools, so you capture on the path their traffic takes. This lab shows three capture points and a repeatable way to find out who a device talks to, whether it encrypts and what firewall rules it actually needs.

Aim and what you need

The aim is to answer three questions about a device you own: which servers does it contact, does it encrypt its traffic, and does it try to reach anything on your local network? The answers help you write tight firewall rules and spot risky devices.

  • A smart device you own, such as a plug, bulb or camera, ideally on an IoT VLAN. Example device address: 192.168.30.20.
  • One capture point: a Linux-based router or firewall with tcpdump, a managed switch with port mirroring (SPAN, Switched Port Analyzer) and a laptop, or a Raspberry Pi acting as the device's Wi-Fi access point.
  • Wireshark on your laptop (see the Wireshark lab).

Legal note: capture only your own devices on a network you control. Captures can contain personal data such as names, locations and camera images, so store them securely and delete them when finished. Capturing other people's traffic without permission is illegal in many countries.

Where to captureCapture pointRoutertcpdump on gatewaySPAN portswitch mirrorPi access pointdevice joins itHost itselfonly for Pi or PC
Figure 1. IoT devices cannot run Wireshark, so you capture on the path their traffic takes.

Steps

  1. Choose a capture point and set it up (commands below).
  2. Start the capture, then power-cycle the device so you record its start-up behaviour.
  3. Use the device's app for one action, such as switching it on, and note the time.
  4. Leave it idle for ten minutes to see background traffic, then stop the capture.
  5. Open the file in Wireshark and work through the analysis filters.
# on a Linux router or Pi access point
sudo tcpdump -i wlan0 -n host 192.168.30.20 -w plug.pcap

# Cisco switch mirror: device on gi0/5, laptop on gi0/24
monitor session 1 source interface gi0/5 both
monitor session 1 destination interface gi0/24
show monitor session 1

# summaries with tshark
tshark -r plug.pcap -q -z conv,ip
tshark -r plug.pcap -Y "dns.flags.response == 0" -T fields -e dns.qry.name | sort | uniq -c | sort -rn
tshark -r plug.pcap -Y "tls.handshake.type == 1" -T fields -e tls.handshake.extensions_server_name | sort -u

# useful Wireshark display filters
ip.addr == 192.168.30.20
dns
tls.handshake.type == 1
mqtt || http
ip.dst == 192.168.10.0/24
udp.port == 5353 || udp.port == 1900
!(tls) && tcp.len > 0
Analysis workflowCaptureone device,one taskConversationswho it talkstoDNS nameswhich servicesProtocolsTLS or plainFindingsrisks, rules
Figure 2. Capture one device doing one thing, then work outwards from conversations to findings you can act on.

What to look for

CheckHealthy signWarning sign
DestinationsA few vendor or cloud namesMany unknown hosts or direct IPs
EncryptionTLS for cloud trafficPlain HTTP or MQTT with readable data
Local trafficOnly replies to your phoneScanning or connecting to other LAN hosts
Time and DNSNTP and DNS to expected serversHard-coded DNS that ignores your resolver

Write a short findings list: each destination, protocol, port and whether you will allow it. Encrypted TLS content cannot be read, but the server name in the handshake (SNI, Server Name Indication) and the timing still tell you a lot.

Troubleshooting and clean-up

  • Empty capture: wrong interface (tcpdump -D lists them) or the device is on a different network.
  • Only broadcast traffic on a laptop: switches send unicast only to the right port, so you need SPAN or a capture on the path.
  • Too much data: filter on the device address and capture for a set time.

Remove the SPAN session with no monitor session 1, return the Pi access point to normal use, and securely delete captures you no longer need. Turn findings into firewall rules and document them.

Practice

Why can a laptop on a normal switch port not see a smart plug's traffic?
A switch forwards unicast frames only to the destination port; you need a mirror port or a capture point on the traffic path.
Traffic is encrypted with TLS. What can you still learn?
Destination IPs, ports, timing, volume and usually the server name from the TLS handshake SNI.
Why power-cycle the device at the start of a capture?
Start-up shows DHCP, DNS lookups, time sync and cloud registration, which reveal most of its normal destinations.

Key takeaways

  • Capture on the path: router, SPAN port or Pi access point.
  • Only capture devices and networks you own or are authorised to test.
  • Start with conversations, DNS names and TLS server names.
  • Plain-text protocols and LAN scanning are warning signs.
  • Turn findings into tighter firewall rules, then delete captures.
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.