Virtual OpenWrt Wi-Fi Lab — Reading a Simulated Capture Honestly
A full OpenWrt router in QEMU with radios from mac80211_hwsim gives you a real MAC-layer network you can capture, with no wireless hardware. Association, the 4-way handshake and deauthentication are byte-for-byte what real gear produces. But a simulated capture is not real air, and the differences are measurable. This page is the analyst's companion, not another setup how-to: the minimal setup, then the measured artifacts that decide what a hwsim capture can and cannot tell you, so you never draw a wrong conclusion from simulated frames.
The minimal setup
Setup itself is covered thoroughly by the Linux kernel mac80211_hwsim docs and the OpenWrt package, so this is the condensed path. Boot the x86-64 generic squashfs-combined image under QEMU user-mode networking, note the loopback bind on the forwards, OpenWrt's root has no password at first boot:
qemu-system-x86_64 -enable-kvm -m 1024 -smp 2 -drive file=openwrt.img,format=raw,if=virtio -netdev user,id=n1,hostfwd=tcp:127.0.0.1:2222-10.0.2.15:22,hostfwd=tcp:127.0.0.1:8080-10.0.2.15:80 -device virtio-net-pci,netdev=n1 -nographic
Switch the LAN to DHCP, then install, and here is the first thing other guides miss, the package manager changed. OpenWrt 24.10 reaches end of life in September 2026; 25.12 replaced opkg with apk:
opkg update && opkg install luci iw-full kmod-mac80211-hwsim wpad-openssl
apk update && apk add luci iw-full kmod-mac80211-hwsim wpad-openssl
What's real, what isn't
- Association and the 4-way handshake (EAPOL M1-M4)
- Beacons, probe requests/responses, the full IE set
- Deauthentication / disassociation with reason codes
- WPA2, WPA3-SAE, PMF, the uci → netifd → hostapd chain
- VLANs, the firewall, DHCP, everything MAC-layer and up
- RSSI / SNR — absent on the monitor, not a constant (measured: 0 of 470 frames carry a signal field)
- Path loss, fading, noise, interference
- EDCA contention, CCA, collisions, retry and aggregation behaviour
- Real PHY rates, OFDMA / MU, offload-firmware behaviour
hwsim copies frames between radios on the same channel, nothing more. For frame loss and delay simulation, the standard tool is wmediumd, which replaces hwsim's in-kernel forwarding.
The measured artifacts (and the wrong conclusion each causes)
These are the things that separate a simulated capture from real air. Every one is measured from a running 24.10.8 lab, and every one will mislead an analyst who doesn't know it.
The MAC layer is faithful — captured proof
Add a third radio as a WPA2 station, capture on hwsim0, and force a reconnect. The full exchange appears, dissectable with the eapol and wlan.fc.type_subtype filters. This is byte-for-byte what a real client produces, only the PHY beneath it is simulated:
Frame sequence only; absolute timings are omitted because the lab was measured under emulation without KVM, which inflates them. Counts and ordering hold; wall-clock does not.
Reading a hwsim capture honestly
The rule of thumb: hwsim is faithful for protocol and security analysis and useless for anything RF, airtime, or PHY-rate related. Use it to study the handshake, not the medium.
References: the Linux kernel mac80211_hwsim documentation, the OpenWrt 25.12 release notes (opkg → apk), and wmediumd for medium simulation. Lab measured on OpenWrt 24.10.8; 25.12.5 package availability verified, runtime not re-measured.