linux下连接无线网出现nl80211: Could not configure driver mode nl80211: deinit ifname=wlan1 disabled_11b_rates=0 wlan1: Failed to initialize driver interface
一.背景
1.1 jello@jello:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.3 LTS
Release: 16.04
Codename: xenial
1.2 usb无线网卡
jello@jello:~$ lsusb|grep Wireless
Bus 001 Device 003: ID 0bda:8179 Realtek Semiconductor Corp. RTL8188EUS 802.11n Wireless Network Adapter
1.3 usb无线网卡使用的驱动
jello@jello:~$ lsmod |grep 8188
r8188eu 454656 0
cfg80211 565248 2 wl,r8188eu
1.4 列出当前的无线网卡设备的当前状态
jello@jello:~$ sudo rfkill list
0: phy0: Wireless LAN
Soft blocked: no
Hard blocked: no
1: brcmwl-0: Wireless LAN
Soft blocked: no
Hard blocked: no
1.5 列出指定无线网卡的配置情况
jello@jello:~$ sudo iwconfig wlan1
wlan1 unassociated Nickname:"<WIFI@REALTEK>"
Mode:Managed Frequency=2.412 GHz Access Point: Not-Associated
Sensitivity:0/0
Retry:off RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality:0 Signal level:0 Noise level:0
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
从此处可以看出当前网卡处于2.412GHz的频率
1.6 列出要连接的无线信号的信息
jello@jello:~$ sudo iwlist wlan1 scan
ell 10 - Address: 62:38:3A:43:12:C3
ESSID:"myWifi"
Protocol:IEEE 802.11bgn
Mode:Master
Frequency:2.472 GHz (Channel 13)
Encryption key:on
Bit Rates:144 Mb/s
Extra:wpa_ie=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
IE: WPA Version 1
Group Cipher : TKIP
Pairwise Ciphers (2) : TKIP CCMP
Authentication Suites (1) : PSK
Extra:rsn_ie=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
IE: IEEE 802.11i/WPA2 Version 1
Group Cipher : TKIP
Pairwise Ciphers (2) : TKIP CCMP
Authentication Suites (1) : PSK
Quality:0 Signal level:0 Noise level:0
从此处可以看出要连接的wifi使用的chan=13
1.7 列出网卡支持的frequency
jello@jello:~$ sudo iwlist wlan1 frequency
wlan1 13 channels in total; available frequencies :
Channel 01 : 2.412 GHz
Channel 02 : 2.417 GHz
Channel 03 : 2.422 GHz
Channel 04 : 2.427 GHz
Channel 05 : 2.432 GHz
Channel 06 : 2.437 GHz
Channel 07 : 2.442 GHz
Channel 08 : 2.447 GHz
Channel 09 : 2.452 GHz
Channel 10 : 2.457 GHz
Channel 11 : 2.462 GHz
Channel 12 : 2.467 GHz
Channel 13 : 2.472 GHz
Current Frequency=2.412 GHz (Channel 1)
二.连接chan=13的wifi无线信号
2.1 启动无线网卡(笔者的usb无线网卡对应的名字为wlan1,请根据自己的情况选择)
sudo ifconfig wlan1 up
2.2 连接加密的chan=13的无线网(wpa_supplicant.conf文件中有无线网的信息)
jello@jello:~$sudo wpa_supplicant -B -iwlan1 -c wpa_supplicant.conf
2.3 通过2.2出现以下错误提示
Successfully initialized wpa_supplicant
nl80211: Could not configure driver mode
nl80211: deinit ifname=wlan1 disabled_11b_rates=0
wlan1: Failed to initialize driver interface
2.4 解决2.3的错误提示
jello@jello:~$ sudo wpa_supplicant -B -iwlan1 -c wpa_supplicant.conf -Dwext
Successfully initialized wpa_supplicant
ioctl[SIOCSIWAP]: Operation not permitted
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument
不用管这些错误信息
2.5 获取ip
jello@jello:~$ sudo dhclient wlan1