Skip to content
Tutorials Center
My learning

Topics

Lesson 7 of 37 ยท Capturing Traffic

Wi-Fi, Monitor Mode and Special Captures

Capture 802.11 Wi-Fi frames with monitor mode and radiotap, and learn loopback, the Linux any device, USB, Bluetooth and remote capture over SSH with extcap.

Wired Ethernet is the easy case. Wi-Fi, loopback and remote machines need special handling, because the frames look different or never touch a normal interface. This lesson covers monitor mode for Wi-Fi, the extra link types you will meet, and remote capture with SSH. Everything here applies to your own networks and devices only; listening to someone else's wireless traffic is illegal in many places.

Wi-Fi in managed mode

By default a Wi-Fi adapter is in managed mode: it talks to one access point and hands you Ethernet-looking frames for your own traffic. You do not see the 802.11 headers, beacons, authentication or other devices' frames. For most application troubleshooting (a slow website over Wi-Fi) this is enough: capture on wlan0 / Wi-Fi as you would on Ethernet.

Monitor mode

In monitor mode the adapter stops being a client and becomes a radio receiver tuned to one channel. It passes up every 802.11 frame it hears, including those of other networks on that channel, with a radiotap header in front of each frame that records signal strength (RSSI), data rate, channel and frequency.

You need an adapter and driver that support it (many Linux chipsets do; macOS supports it on built-in adapters through Wireless Diagnostics or the Wireshark option; Windows support is limited and depends on Npcap and the driver). Typical Linux steps:

Terminal
sudo ip link set wlan0 down
sudo iw dev wlan0 set type monitor
sudo ip link set wlan0 up
sudo iw dev wlan0 set channel 6

or tick Monitor in Wireshark's capture options. In monitor mode you leave the network (no IP traffic for the machine) and you see only one channel at a time. Capture only on your own access points, in a lab, or with the owner's consent.

What you see in 802.11

An 802.11 frame has a frame control field whose type and subtype say what it is:

Type Name Examples
0 Management Beacon, Probe Request/Response, Authentication, Association, Deauthentication
1 Control RTS, CTS, ACK, Block Ack
2 Data Data, QoS Data, Null

Useful display filters: wlan.fc.type == 0 (management), wlan.fc.type_subtype == 0x08 (beacons), wlan.fc.retry == 1 (retransmitted frames, a sign of a noisy channel), radiotap.dbm_antsignal < -80 (weak signal).

The stand-in decodes the first byte of the frame control field the way Wireshark's dissector does. The byte values are made up for the exercise.

Python Decode an 802.11 frame control byte (stand-in)

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Channels and frequencies

Wi-Fi channels map to frequencies. In the 2.4 GHz band, channel 1 is 2412 MHz and each channel adds 5 MHz (channels 1-13), so channels 1, 6 and 11 do not overlap. In 5 GHz, frequency is 5000 + 5 x channel MHz. Wireshark shows both. A capture only contains the channel the adapter was tuned to, so for a full survey you hop channels or use several adapters.

Python Channel to frequency (stand-in)

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Decrypting your own WPA2/WPA3 traffic

Data frames on a protected network are encrypted. For your own network you can decrypt them in Wireshark (Edit > Preferences > Protocols > IEEE 802.11 > Decryption keys) by supplying the passphrase and SSID, provided you captured the 4-way handshake of the client you want to read (WPA2-Personal). WPA3 and per-session keys make passive decryption impractical without the keys, which is the point of the protocol. This is a debugging technique for networks you administer, not a way into other people's.

Loopback and the "any" device

  • Loopback (lo, lo0, Npcap Loopback Adapter): local traffic to 127.0.0.1 and ::1. The link type is Null/Loopback (BSD systems) or Ethernet with zero MAC addresses (Linux lo). There is no real Ethernet header, so MAC columns look empty.
  • any on Linux: captures all interfaces at once in the Linux cooked capture format (SLL/SLL2), which has a pseudo header with the interface index and direction instead of Ethernet addresses. Handy when you do not know which interface carries the traffic. You cannot use monitor mode or promiscuous mode on any.

USB, Bluetooth and other sources

Wireshark can capture USB (Linux usbmonN, Windows with USBPcap), Bluetooth (HCI on Linux, or via special hardware), CAN bus and more, so you can debug a USB device or a Bluetooth sensor with the same tool. Filter names such as usb.device_address or btatt apply to those protocols.

Remote capture with extcap

Extcap plugins let Wireshark capture from sources that are not local interfaces. They appear in the interface list:

  • sshdump connects over SSH and runs tcpdump or dumpcap on a remote host; the packets stream to your Wireshark. Great for a server in a data center. Use key authentication, and remember to exclude your own SSH port with a capture filter.
  • androiddump captures from an Android device attached via adb (debug builds and development devices).
  • ciscodump, wifidump and others handle specific devices.

The same idea with plain tools (read-only example, do not run it against hosts you do not administer):

Terminal
ssh [email protected] "sudo tcpdump -U -s0 -i eth0 -w - 'not port 22'" | wireshark -k -i -

-w - writes the capture to standard output, -U flushes packet by packet, and -k -i - tells Wireshark to start immediately and read from standard input. Never open a raw remote capture port on the Internet; it exposes everything the server sees. Prefer SSH tunnels.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What extra header does monitor mode add in front of each 802.11 frame?

    Radiotap carries radio metadata such as RSSI, data rate and frequency.
  2. 2. You see only your own traffic and no beacons when capturing on Wi-Fi. Why?

    In managed mode the driver gives you Ethernet-style frames for your own connection, not raw 802.11 frames.
  3. 3. On Linux, which interface name captures from all interfaces at once?

    The special device 'any' captures from all interfaces using the Linux cooked format.
  4. 4. Which statement about decrypting Wi-Fi traffic is correct?

    Decryption needs the key material; it is a legitimate debugging tool only for networks you administer.

Summary

  • Managed-mode Wi-Fi capture looks like Ethernet; monitor mode shows raw 802.11 frames with a radiotap header, one channel at a time.
  • 802.11 frames are management, control or data; useful filters include wlan.fc.type and wlan.fc.retry.
  • Capture wireless traffic only on networks you own or may test.
  • Loopback, any, USB, Bluetooth and extcap sources use different link types, so the first header is not always Ethernet.
  • Remote capture over SSH lets you analyze servers without exposing capture ports.

Next: dumpcap, tshark and Long Captures