We can make use of wtap(4) for simulating 802.11 device:
## Load wtap.ko
Goto sys/modules/wtap, and load wtap.ko (may need the priority of super user):
```
kldload ./wtap.ko
```
## Create two parent wlan devices wtap0, wtap1
Goto tools/tools/wtap/wtap, and follow the commands below (may need the priority of super user) :
```
./wtap c 0
./wtap c 1
```
## Create two child wlan devices (vap) wlan0, wlan1 in IBSS mode (with the same SSID)
Follow the commands below (may need the priority of super user) :
```
ifconfig wlan0 create wlandev wtap0 wlanmode adhoc
ifconfig wlan1 create wlandev wtap1 wlanmode adhoc ssid <SSID you want to test>
```
## Use visibility tool to enable communications between wlan0 and wlan1
Goto tools/tools/wtap/vis_map, and follow the commands below (may need the priority of super user) :
```
./vis_map o
./vis_map a 0 1
./vis_map a 1 0
```
## SSID scan test
Bring up wlan0, wlan1:
```
ifconfig wlan0 up
ifconfig wlan1 up
```
Correctly setup locale:
```
export LC_ALL=<your locale>
```
Then perform scanning, and see whether the output is desired:
```
ifconfig wlan0 scan
```