Sunday, January 7, 2018

virtual wireless link simulator of 802.11 radio

mac80211_hwsim  can be used to simulate number of IEEE 802.11 radios for mac80211. It can be used to test most of the mac80211 functionality and user space tools in a way that matches very closely with the normal case of using real WLAN hardware. From the mac80211 view point, mac80211_hwsim is yet another hardware driver, i.e., no changes to mac80211 are needed to use this testing tool.


1- load  mac80211_hwsim  kernel module

$ sudo modprobe mac80211_hwsim

- it will create two interfaces, wlan0 and wlan1, one will configured in hostapd and another will configured in wpa_suppliant

2-  hostapd configuration, ap.conf

interface=wlan0
ssid=HWSim
hw_mode=g
channel=11
macaddr_acl=0
wpa=3
wpa_passphrase=12testtest
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP






- run hostapd
$ sudo hostapd ap.conf

3- wpa_suppliant configuration, cli.conf
$ wpa_passphrase HWSim 12testtest > cli.conf

- cli.conf
network={
    ssid="HWSim"
    #psk="12testtest"
    psk=007bbe2594015c37d5909bacd7798f6d4c839af5384342c7e16ec34e913b7dc3
}



4- to connect
$ sudo wpa_supplicant -Dnl80211 -i wlan1 -c cli.conf


No comments:

Post a Comment