vwifi — virtual WiFi for mesh tests¶
vwifi bridges mac80211_hwsim radios across separate QEMU VMs, making them visible to each other as if they share physical WiFi. This is what allows LibreMesh's batman-adv/babeld mesh to form between virtual nodes.
How it works¶
VM1 (mac80211_hwsim + vwifi-client) ──┐
VM2 (mac80211_hwsim + vwifi-client) ──┼── TCP ──► vwifi-server (host)
VM3 (mac80211_hwsim + vwifi-client) ──┘
mac80211_hwsimcreates virtual WiFi radios inside each VMvwifi-clientconnects each VM's radios tovwifi-serverover TCPvwifi-serverforwards 802.11 frames between all connected clients- VMs see a shared medium — association, beacons, and mesh peering work normally
Without vwifi, hwsim radios on different VMs are isolated and batman-adv cannot form neighbors across VMs.
Installing vwifi-server (host)¶
git clone https://github.com/Raizo62/vwifi.git
cd vwifi
make
sudo make install # installs vwifi-server to /usr/local/bin
Or build from the Debian/Ubuntu package if available:
sudo apt install vwifi # if packaged in your distro
Verify:
vwifi-server --version
Installing vwifi-client (VM image)¶
The client is built as an OpenWrt package via the feed at vwifi_cli_package. To include it in a custom image:
- Clone OpenWrt
- Add to
feeds.conf:src-git vwifi https://github.com/javierbrk/vwifi_cli_package.git - Update and install feeds:
scripts/feeds update -a scripts/feeds install -a - Enable in
make menuconfig→ Network → vwifi-client - Build the image
Pre-built images with vwifi-client are stored at firmwares/qemu/libremesh/.
Configuring vwifi-client inside a VM¶
After boot, the client needs to know the server IP (the QEMU host is always 10.0.2.2 in user-mode networking):
uci set vwifi.config.server_ip=10.0.2.2
uci set vwifi.config.mac_prefix="74:f8:f6:66"
uci set vwifi.config.enabled='1'
uci commit vwifi
service vwifi-client start
In the LibreMesh images used for CI this is pre-configured at build time — the client starts automatically on boot.
Running vwifi-server for tests¶
Start the server before launching VMs:
vwifi-server &
The default port is 9090 (TCP). VMs connect on startup; no further configuration needed on the host side.
Verifying the mesh formed¶
After VMs are up and vwifi-client is running in each:
# On vm1 (ssh -p 10022 root@127.0.0.1)
batctl n # should show MAC addresses of vm2, vm3
ip route show proto babel # babeld routes should appear
If batctl n is empty, check:
vwifi-serveris running on the hostvwifi-clientstarted in each VM (logread | grep vwifi)wpadis running andwlan0-meshis up (ip link show wlan0-mesh)kmod-mac80211-hwsimis loaded (lsmod | grep hwsim)