我尝试使用 wpa_supplicant 从命令行连接 wifi。
我使用 Ubuntu 12.04.1 和 wpa_supplicant 0.7.3
以下是与我尝试连接的 AP 相关的“iwlist wlan0 scan”的输出:
2: Cell 01 - Address: 00:11:22:33:44:55
3- Channel:11
4- Frequency:2.462 GHz (Channel 11)
5- Quality=35/70 Signal level=-75 dBm
6- Encryption key:on
7- ESSID:"NetworkName"
8- Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 9 Mb/s
9- 18 Mb/s; 36 Mb/s; 54 Mb/s
10- Bit Rates:6 Mb/s; 12 Mb/s; 24 Mb/s; 48 Mb/s
11- Mode:Master
12- Extra:tsf=000004c96af22169
13- Extra: Last beacon: 2828ms ago
14- IE: Unknown: 00075732575F446176
15- IE: Unknown: 010882848B961224486C
16- IE: Unknown: 03010B
17- IE: Unknown: 2A0104
18- IE: Unknown: 32040C183060
19- IE: Unknown: 2D1A6E1017FFFF000001000000000000000000000000000000000000
20- IE: Unknown: 3D160B000100000000000000000000000000000000000000
21- IE: Unknown: 3E0100
22- IE: WPA Version 1
23- Group Cipher : TKIP
24- Pairwise Ciphers (2) : TKIP CCMP
25- Authentication Suites (1) : PSK
26- IE: Unknown: DD180050F2020101000003A4000027A4000042435E0062322F00
27- IE: Unknown: 7F0101
28- IE: Unknown: DD07000C4300000000
29- IE: Unknown: DD1E00904C336E1017FFFF000001000000000000000000000000000000000000
30- IE: Unknown: DD1A00904C340B000100000000000000000000000000000000000000
我使用 wpa_passphrase 创建 psk:
user@comp-name:~$ wpa_passphrase "NetworkName" "Password"
这是 /etc/wpa_supplicant.conf 的内容:
network={
ssid="NetworkName"
psk=3d2e908171ebc0aca77f9cf0d4fd392ff76bb4236fa20a8718f1de4c92d5b81d
}
我调用 wpa_supplicant:
user@comp-name:~$ sudo wpa_supplicant -d -iwlan0 -Dwext -Dnl80211 -c/etc/wpa_supplicant.conf
输出:
Initializing interface 'wlan0' conf '/etc/wpa_supplicant.conf' driver 'nl80211' ctrl_interface 'N/A' bridge 'N/A'
Configuration file '/etc/wpa_supplicant.conf' -> '/etc/wpa_supplicant.conf'
Reading configuration file '/etc/wpa_supplicant.conf'
Priority group 0
id=0 ssid='NetworkName'
netlink: Operstate: linkmode=1, operstate=5
nl80211: Register Action command failed: ret=-114 (Operation already in progress)
nl80211: Register Action match - hexdump(len=1): 06
nl80211: Failed to register Action frame processing - ignore for now
Own MAC address: 00:21:6b:1e:04:0a
wpa_driver_nl80211_set_key: ifindex=3 alg=0 addr=0x80e4f28 key_idx=0 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=3 alg=0 addr=0x80e4f28 key_idx=1 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=3 alg=0 addr=0x80e4f28 key_idx=2 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=3 alg=0 addr=0x80e4f28 key_idx=3 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=3 alg=0 addr=0x80e4f28 key_idx=4 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=3 alg=0 addr=0x80e4f28 key_idx=5 set_tx=0 seq_len=0 key_len=0
RSN: flushing PMKID list in the driver
Setting scan request: 0 sec 100000 usec
WPS: UUID based on MAC address - hexdump(len=16): 5e 04 92 17 d9 f6 5a 71 8c c8 9d ec 15 53 ce 94
EAPOL: SUPP_PAE entering state DISCONNECTED
EAPOL: Supplicant port status: Unauthorized
EAPOL: KEY_RX entering state NO_KEY_RECEIVE
EAPOL: SUPP_BE entering state INITIALIZE
EAP: EAP entering state DISABLED
EAPOL: Supplicant port status: Unauthorized
EAPOL: Supplicant port status: Unauthorized
Added interface wlan0
RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP])
RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
State: DISCONNECTED -> SCANNING
Starting AP scan for wildcard SSID
Scan requested (ret=0) - scan timeout 10 seconds
nl80211: Event message available
nl80211: Scan trigger
EAPOL: disable timer tick
EAPOL: Supplicant port status: Unauthorized
nl80211: Event message available
nl80211: New scan results available
Received scan results (42 BSSes)
BSS: Start scan result update 1
BSS: Add new id 0 BSSID 00:22:3f:ad:8c:8e SSID 'DartyBox_C62E'
New scan results available
Selecting BSS from priority group 0
Try to find WPA-enabled AP
0: 00:22:3f:ad:8c:8e ssid='DartyBox_C62E' wpa_ie_len=28 rsn_ie_len=0 caps=0x411
skip - SSID mismatch
1: 00:11:22:33:44:55 ssid='NetworkName' wpa_ie_len=26 rsn_ie_len=0 caps=0x411
selected based on WPA IE
selected WPA AP 00:11:22:33:44:55 ssid='NetworkName'
Automatic auth_alg selection: 0x1
WPA: using IEEE 802.11i/D3.0
WPA: Selected cipher suites: group 8 pairwise 24 key_mgmt 2 proto 1
WPA: set AP WPA IE - hexdump(len=28): dd 1a 00 50 f2 01 01 00 00 50 f2 02 02 00 00 50 f2 02 00 50 f2 04 01 00 00 50 f2 02
WPA: clearing AP RSN IE
WPA: using GTK TKIP
WPA: using PTK CCMP
WPA: using KEY_MGMT WPA-PSK
WPA: not using MGMT group cipher
WPA: Set own WPA IE default - hexdump(len=24): dd 16 00 50 f2 01 01 00 00 50 f2 02 01 00 00 50 f2 04 01 00 00 50 f2 02
FT: Stored MDIE and FTIE from (Re)Association Response - hexdump(len=0):
Cancelling scan request
Trying to authenticate with 00:11:22:33:44:55 (SSID='NetworkName' freq=2462 MHz)
No keys have been configured - skip key clearing
State: SCANNING -> AUTHENTICATING
EAPOL: External notification - EAP success=0
EAPOL: Supplicant port status: Unauthorized
EAPOL: External notification - EAP fail=0
EAPOL: Supplicant port status: Unauthorized
EAPOL: External notification - portControl=Auto
EAPOL: Supplicant port status: Unauthorized
nl80211: Authenticate (ifindex=3)
* bssid=00:11:22:33:44:55
* freq=2462
* SSID - hexdump_ascii(len=7):
57 32 57 5f 44 61 76 NetworkName
* IEs - hexdump(len=0): [NULL]
* Auth Type 0
nl80211: Authentication request send successfully
RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP])
RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
nl80211: Event message available
nl80211: MLME event 37
SME: Authentication response: peer=00:11:22:33:44:55 auth_type=0 status_code=0
Trying to associate with 00:11:22:33:44:55 (SSID='NetworkName' freq=2462 MHz)
State: AUTHENTICATING -> ASSOCIATING
wpa_driver_nl80211_set_operstate: operstate 0->0 (DORMANT)
netlink: Operstate: linkmode=-1, operstate=5
WPA: set own WPA/RSN IE - hexdump(len=24): dd 16 00 50 f2 01 01 00 00 50 f2 02 01 00 00 50 f2 04 01 00 00 50 f2 02
nl80211: Associate (ifindex=3)
* bssid=00:11:22:33:44:55
* freq=2462
* SSID - hexdump_ascii(len=7):
57 32 57 5f 44 61 76 NetworkName
* IEs - hexdump(len=24): dd 16 00 50 f2 01 01 00 00 50 f2 02 01 00 00 50 f2 04 01 00 00 50 f2 02
nl80211: Association request send successfully
nl80211: Event message available
nl80211: Ignored unknown event (cmd=19)
nl80211: Event message available
nl80211: MLME event 38
Association info event
resp_ies - hexdump(len=163): 01 08 82 84 8b 96 12 24 48 6c 32 04 0c 18 30 60 dd 18 00 50 f2 02 01 01 00 00 03 a4 00 00 27 a4 00 00 42 43 5e 00 62 32 2f 00 2d 1a 6e 10 17 ff ff 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3d 16 0b 00 05 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 dd 1e 00 90 4c 33 6e 10 17 ff ff 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 dd 1a 00 90 4c 34 0b 00 05 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 dd 07 00 0c 43 00 00 00 00
freq=2462 MHz
FT: Stored MDIE and FTIE from (Re)Association Response - hexdump(len=0):
State: ASSOCIATING -> ASSOCIATED
wpa_driver_nl80211_set_operstate: operstate 0->0 (DORMANT)
netlink: Operstate: linkmode=-1, operstate=5
Associated to a new BSS: BSSID=00:11:22:33:44:55
No keys have been configured - skip key clearing
Associated with 00:11:22:33:44:55
WPA: Association event - clear replay counter
WPA: Clear old PTK
EAPOL: External notification - portEnabled=0
EAPOL: Supplicant port status: Unauthorized
EAPOL: External notification - portValid=0
EAPOL: Supplicant port status: Unauthorized
EAPOL: External notification - EAP success=0
EAPOL: Supplicant port status: Unauthorized
EAPOL: External notification - portEnabled=1
EAPOL: SUPP_PAE entering state CONNECTING
EAPOL: enable timer tick
EAPOL: SUPP_BE entering state IDLE
Setting authentication timeout: 10 sec 0 usec
Cancelling scan request
RTM_NEWLINK: operstate=0 ifi_flags=0x11003 ([UP][LOWER_UP])
RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
RTM_NEWLINK: operstate=0 ifi_flags=0x11003 ([UP][LOWER_UP])
RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
RTM_NEWLINK: operstate=0 ifi_flags=0x11003 ([UP][LOWER_UP])
RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP])
RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
nl80211: Event message available
nl80211: Ignore connect event (cmd=46) when using userspace SME
nl80211: Event message available
nl80211: MLME event 40
Disassociation notification
SME: Disassociation event received
SME: Deauthenticate to clear driver state
wpa_driver_nl80211_deauthenticate
nl80211: MLME command failed: ret=-107 (Transport endpoint is not connected)
Setting scan request: 0 sec 100000 usec
Added BSSID 00:11:22:33:44:55 into blacklist
CTRL-EVENT-DISCONNECTED bssid=00:11:22:33:44:55 reason=3
Disconnect event - remove keys
wpa_driver_nl80211_set_key: ifindex=3 alg=0 addr=0x80e4f28 key_idx=0 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=3 alg=0 addr=0x80e4f28 key_idx=1 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=3 alg=0 addr=0x80e4f28 key_idx=2 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=3 alg=0 addr=0x80e4f28 key_idx=3 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=3 alg=0 addr=0x80e4f28 key_idx=4 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=3 alg=0 addr=0x80e4f28 key_idx=5 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=3 alg=0 addr=0x9137574 key_idx=0 set_tx=0 seq_len=0 key_len=0
addr=00:11:22:33:44:55
State: ASSOCIATED -> DISCONNECTED
wpa_driver_nl80211_set_operstate: operstate 0->0 (DORMANT)
netlink: Operstate: linkmode=-1, operstate=5
EAPOL: External notification - portEnabled=0
EAPOL: SUPP_PAE entering state DISCONNECTED
EAPOL: Supplicant port status: Unauthorized
EAPOL: SUPP_BE entering state INITIALIZE
EAPOL: Supplicant port status: Unauthorized
EAPOL: External notification - portValid=0
EAPOL: Supplicant port status: Unauthorized
EAPOL: External notification - EAP success=0
EAPOL: Supplicant port status: Unauthorized
nl80211: Event message available
nl80211: Ignore disconnect event when using userspace SME
nl80211: Event message available
nl80211: Ignored unknown event (cmd=20)
nl80211: Event message available
nl80211: MLME event 39
Deauthentication notification
Added BSSID 00:00:00:00:00:00 into blacklist
CTRL-EVENT-DISCONNECTED bssid=00:00:00:00:00:00 reason=3
Disconnect event - remove keys
wpa_driver_nl80211_set_key: ifindex=3 alg=0 addr=0x80e4f28 key_idx=0 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=3 alg=0 addr=0x80e4f28 key_idx=1 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=3 alg=0 addr=0x80e4f28 key_idx=2 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=3 alg=0 addr=0x80e4f28 key_idx=3 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=3 alg=0 addr=0x80e4f28 key_idx=4 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=3 alg=0 addr=0x80e4f28 key_idx=5 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=3 alg=0 addr=0x9137574 key_idx=0 set_tx=0 seq_len=0 key_len=0
addr=00:00:00:00:00:00
State: DISCONNECTED -> DISCONNECTED
wpa_driver_nl80211_set_operstate: operstate 0->0 (DORMANT)
netlink: Operstate: linkmode=-1, operstate=5
EAPOL: External notification - portEnabled=0
EAPOL: Supplicant port status: Unauthorized
EAPOL: External notification - portValid=0
EAPOL: Supplicant port status: Unauthorized
EAPOL: External notification - EAP success=0
EAPOL: Supplicant port status: Unauthorized
State: DISCONNECTED -> SCANNING
Starting AP scan for wildcard SSID
Scan requested (ret=0) - scan timeout 30 seconds
nl80211: Event message available
nl80211: Scan trigger
RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP])
RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
EAPOL: startWhen --> 0
EAPOL: disable timer tick
EAPOL: Supplicant port status: Unauthorized
^CCTRL-EVENT-TERMINATING - signal 2 received
Removing interface wlan0
No keys have been configured - skip key clearing
State: SCANNING -> DISCONNECTED
wpa_driver_nl80211_set_operstate: operstate 0->0 (DORMANT)
netlink: Operstate: linkmode=-1, operstate=5
EAPOL: External notification - portEnabled=0
EAPOL: Supplicant port status: Unauthorized
EAPOL: External notification - portValid=0
EAPOL: Supplicant port status: Unauthorized
EAPOL: External notification - EAP success=0
EAPOL: Supplicant port status: Unauthorized
No keys have been configured - skip key clearing
Removed BSSID 00:00:00:00:00:00 from blacklist (clear)
Removed BSSID 00:11:22:33:44:55 from blacklist (clear)
BSS: Remove id 0 BSSID 00:22:3f:ad:8c:8e SSID 'DartyBox_C62E'
Cancelling scan request
Cancelling authentication timeout
netlink: Operstate: linkmode=0, operstate=6
有任何想法吗?
答案1
我以前也见过这样的错误信息,但没有明确的解决方案。你可能想尝试以下方法:
读wpa_supplicant.conf(5)。这些示例将让您了解可以尝试的额外网络选项。不要忘记为 加上双引号
psk=
。改用
-Dnl80211
。看来这是您需要的驱动程序。试验路由器的网络模式(B/G/N)。尝试将其设置为不同的值,因为路由器和无线网卡/驱动程序之间可能存在不兼容的情况。
给兼容无线试试吧。我以前没有亲自用过它,但我读到过它包含一些补丁,可以修复过去遇到的类似问题。
答案2
我在 Gentoo 中通过关闭 NetworkManager 修复了这个问题:
/etc/init.d/NetworkManager stop
当两者都运行时,它可能会与 wpa_supplicant 发生冲突。
答案3
我在 Ubuntu 18.10 上通过以下方式修复了此问题:/etc/init.d/network-manager stop