Nl80211: could not configure driver mode [HostAPd error]

hostapd
fakeap

(Nguyên Trung) #1

I got this problem when I try to use hostapd on Kali Linux 2018.1

nl80211: Could not configure driver mode

I am using TP-link WR722n. Can u give me some suggestion?


(Hardeep Singh) #2

This is probably because the nl80211 driver of hostapd is clashing with the drivers of network-manager utility.

They are basically fighting to take charge of the wireless device you are trying to configure with hostapd.
If you notice, when you put the card in monitor mode manually using the following commands:

All commands are being run as root

ifconfig wlan0 down
iwconfig wlan0 mode monitor
ifconfig wlan0 up

After a few seconds, the card jumps back to mode:managed

This is because the card is being managed by network-manager utility. So, there are two ways you can tackle this issue:

  1. airmon-ng check kill to kill all the potentially troublesome processes, like network-manager, wpa_supplicant, dhclient
  2. Make your selected card an exception in network-manager, so that it ignores the card and not mess with it ever.

How to make network-manager ignore your wireless card

– Get you wireless card’s MAC address/hardware address

ifconfig wlan0 | grep -i hwaddr

It will show an output like this:

wlan0 Link encap:Ethernet HWaddr 7d:e6:d2:30:9f:f2

– Open the network-manager configuration file: NetworkManager.conf

nano /etc/NetworkManager/NetworkManager.conf

Add the following code and replace the MAC address with your selected device’s MAC

[main]
plugins=ifupdown,keyfile

[ifupdown]
managed=false

[keyfile]
unmanaged-devices=mac:7d:e6:d2:30:9f:f2

Hit CTRL + O to save and CTRL + X to exit.

– Restart network-manager:

service network-manager restart 

This must fix the Could not configure driver mode error.


(404) #3

If you regularly use different external wifi adapters and always want wlan0 to be free from NetworkManager interference then you can specify the interface by name rather than mac address:

[keyfile]
unmanaged-devices=interface-name:wlan0

(Hardeep Singh) #4

Right!

I found this little trick to be very helpful when we want to un-manage the multiple cards but don’t want to copy mac addresses for each.

Just separate interface names by comma did it for me.

[keyfile]
unmanaged-devices=interface-name:wlan1,wlan2