Virtual WiFi / 802.11 interface similar to VETH on Linux
I attempted to follow hints posted by Stefano Cappa without luck. My interfaces consistently report No valid interface combinations
which suggested I should be stuck (but wasn't).
Virtual WIFI can be brought up with the help of
- mac80211_hwsim kernel module
- module is configurable with the
radios
parameter indicating number of virtual physical cards (phy#
). - Each
phy#
can simulate an independent wireless radio card. - Each
phy#
card gets an associated lan interface (wlan#
). - module brings also a
hwsim#
interface which can be used to snoop on the pseudo-wifi traffic happening between all radio cards.
- module is configurable with the
hostapd
tool that is capable of turning any radio (including the simulated one) into an access point,wpa_supplicant
tool that can be used to scan the area for access points or connect to these.
I have eventually come up with a solution (took me a while, as I'm trying to achieve that with Android) that relies just on these three things. The tools would use nl80211
driver to talk to the pseudo-hardware.
My simplistic configuration files look as follows:
hostapd.conf (note, this file has more settings than required, but i'm posting all of my settings here)
interface=wlan1
driver=nl80211
logger_syslog=-1
logger_syslog_level=2
logger_stdout=-1
logger_stdout_level=2
ctrl_interface_group=0
ssid=Vamonos Pest
country_code=US
hw_mode=g
channel=1
beacon_int=100
dtim_period=2
max_num_sta=255
rts_threshold=2347
fragm_threshold=2346
macaddr_acl=0
auth_algs=3
ignore_broadcast_ssid=0
wmm_enabled=1
wmm_ac_bk_cwmin=4
wmm_ac_bk_cwmax=10
wmm_ac_bk_aifs=7
wmm_ac_bk_txop_limit=0
wmm_ac_bk_acm=0
wmm_ac_be_aifs=3
wmm_ac_be_cwmin=4
wmm_ac_be_cwmax=10
wmm_ac_be_txop_limit=0
wmm_ac_be_acm=0
wmm_ac_vi_aifs=2
wmm_ac_vi_cwmin=3
wmm_ac_vi_cwmax=4
wmm_ac_vi_txop_limit=94
wmm_ac_vi_acm=0
wmm_ac_vo_aifs=2
wmm_ac_vo_cwmin=2
wmm_ac_vo_cwmax=3
wmm_ac_vo_txop_limit=47
wmm_ac_vo_acm=0
eapol_key_index_workaround=0
eap_server=0
own_ip_addr=127.0.0.1
wpa_supplicant.conf
network={
ssid="Vamonos Pest"
key_mgmt=NONE
priority=16
}
Finally launched the two:
hostapd -d hostapd.conf
wpa_supplicant -Dnl80211 -iwlan0 -d -csupplicant.conf
that did the trick. wpa_supplicant
is capable of scanning network area and finding all the virtual wifi access points. more can be created if hwsim module uses more that two radios. From here the rest is easy - start dhcp server on wlan1, dhcp client on wlan0 and you're done.