# create wtap devices
```
wtapctl device create 0
wtapctl device create 1
```
# add links in visibility tool
```
wtapctl vis open
wtapctl vis add 0 1
wtapctl vis add 1 0
```
# create vaps
```
ifconfig wlan0 create wlandev wtap0 wlanmode hostap ssid test
ifconfig wlan1 create wlandev wtap1 wlanmode sta ssid test
```
# run hostapd on wlan0
```
hostapd -i wlan0 hostapd.conf
```
Here is the hostapd.conf for example:
```
interface=wlan0
ssid=test
wpa=2
hw_mode=b
channel=1
wpa_key_mgmt=WPA-PSK
wpa_passphrase=12345678
```
# run wpa_supplicant on wlan1
```
wpa_supplicant -i wlan1 -dd -c wpa.conf
```
Here is the wpa.conf for example:
```
network={
ssid="test"
psk=fe727aa8b64ac9b3f54c72432da14faed933ea511ecab15bbc6c52e7522f709a
}
```
# see connection result
After running wpa_supplicant, one may check whether wlan1 connects to wlan0 by ifconfig(8):
```
ifconfig wlan1 | grep bssid
```
If one wants to do ping test between the two interfaces, he or she may need jail(8).