Load mac80211_hwsim

  • In this section, you are going to learn

  • How to load mac80211_hwsim with 3 radios

#

Version

Ubuntu

Ubuntu 22.04 64 bit

Linux Kernel

6.5.0

  • Stop applications by running the commands below:

test:~$ pwd
/home/test

test:~$ sudo systemctl stop NetworkManager.service

test:~$ sudo killall wpa_supplicant hostapd

test:~$ ps -N | grep -i wpa_supplicant

test:~$ ps -N | grep -i hostapd
  • Now, remove drivers by executing rmmod command as shown below:

test:~$ sudo rmmod mac80211_hwsim
test:~$ sudo rmmod mac80211
test:~$ sudo rmmod libarc4
test:~$ sudo rmmod lib80211
test:~$ sudo rmmod cfg80211
test:~$ sudo insmod /lib/modules/$(uname -r)/kernel/net/wireless/cfg80211.ko
test:~$ sudo insmod /lib/modules/$(uname -r)/kernel/net/wireless/lib80211.ko
test:~$ sudo insmod /lib/modules/$(uname -r)/kernel/lib/crypto/libarc4.ko
test:~$ sudo insmod /lib/modules/$(uname -r)/kernel/net/mac80211/mac80211.ko
test:~$ sudo insmod /lib/modules/$(uname -r)/kernel/drivers/net/wireless/virtual/mac80211_hwsim.ko radios=3
test:~$ lsmod
Module                  Size  Used by
mac80211_hwsim        122880  0
mac80211             1720320  1 mac80211_hwsim
libarc4                12288  1 mac80211
lib80211               16384  0
cfg80211             1323008  2 mac80211_hwsim,mac80211
  • Check if 3 wlan interfaces are created

  • wlan0 will be used for ap

  • wlan1 will be used for station

  • wlan2 will be used as monitor mode to capture packets between station and ap

test:~$ iwconfig
wlan0     IEEE 802.11  ESSID:off/any
          Mode:Managed  Access Point: Not-Associated   Tx-Power=20 dBm
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Power Management:off

wlan1     IEEE 802.11  ESSID:off/any
          Mode:Managed  Access Point: Not-Associated   Tx-Power=20 dBm
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Power Management:off

wlan2     IEEE 802.11  ESSID:off/any
          Mode:Managed  Access Point: Not-Associated   Tx-Power=20 dBm
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Power Management:off