![无法通过 wpa_supplicant 连接到 wlan0](https://linux22.com/image/135507/%E6%97%A0%E6%B3%95%E9%80%9A%E8%BF%87%20wpa_supplicant%20%E8%BF%9E%E6%8E%A5%E5%88%B0%20wlan0.png)
我无法在 Debian Linux 中连接到无线网络。
我首先输入以下命令:
iwconfig
这是我的输出:
wlan0 IEEE 802.11abgn ESSID:off/any
Mode:Managed Access Point: Not-Associated Tx-Power=0 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:on
接下来我输入:
ifconfig wlan0 up
然后我使用以下命令扫描网络:
iwlist scan | more
我看到了我想要连接的网络,所以我知道它至少在我的计算机上可见。
然后我输入这个命令:
cat /etc/wpa_supplicant.conf
这是我的输出:
ctrl_interface=/var/run/wpa_supplicant
network={
ssid="wireless_network_name"
key_mgmt=WPA-PSK
psk="wireless_network_password"
}
为了更改 ssid 和密钥,我使用以下命令:
wpa_passphrase "My Network Name" "Password" > /etc/wpa_supplicant.conf
我查看了文件内容,发现它们实际上已更改为正确的 ssid 和密码。
然后我输入(这是错误发生的地方):
wpa_supplicant -B -Dwext -c /etc/wpa_supplicant.conf -i wlan0
我得到的输出是:
Successfully initialized wpa_supplicant
ioct1[SIOCSIWENCODEEXT]: Invalid argument
ioct1[SIOCSIWENCODEEXT]: Invalid argument
我尝试终止 wpa_supplicant 中的进程并重试并重新启动。我不知道该做什么,希望得到一些指导。
建议1(对我来说不起作用)
输入:
wpa_supplicant -B -D nl80211 -c /etc/wpa_supplicant.conf -i wlan0
输出:
Successfully initialized wpa_supplicant
输入:
ifconfig wlan0
输出:
flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::3ea3:8ff:fec8:5a87 prefixlem 64 scopeid 0x20<link>
ether 3c:a3:08:c8:5a:87 txqueuelen 1000 (Ethernet)
RX packets 4 bytes 380 (380.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 7 bytes 806 (806.6 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
输入:
iwconfig wlan0
输出:
wlan0 IEEE 802.11abgn EESID:"My Network Name"
Mode: Managed Frequency: 2.437 GHz Access Point: AC:86:74:86:D6:CA
Bit Rate=72.2 Mb/s Tx-Power=20 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:on
Link Quality=68/70 Signal level=-42 dBm
Rx invalid nwid:0 Rx invalid crpyt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
建议2
添加update_config=1
到 wpa_supplicant.conf
输入
echo 'update_config=1' >> /etc/wpa_supplicant.conf
现在运行不带 -B 或 -D 的 wpa_supplicant 命令。
Successfully initialized wpa_supplicant
wlan0: CTRL-EVENT-REGDOM-CHANGE init=BEACON_HINT type=UNKNOWN
nl80211: send_and_recv->nl_recvmsgs failed: -33
wlan0: SME: Trying to authenticate with ac:86:74:92:fc:8a (SSID='My Network Name' freq=2347 MHz)
wlan0: CTRL-EVENT-DISCONNECTED bssid=ac:86:74:92:fc:8a reason=2 locally_generated=1
wlan0: Trying to associate with ac:86:74:92:fc:8a (SSID='My Network Name' freq=2347 MHz)
wlan0: Associated with ac:86:74:92:fc:8a
wlan0: WPA: Invalid EAPOL-Key MIC when using TPIK - ignoring TPIK
wlan0: WPA: Could not verify EAPOL-KEY MIC - dropping packet
Authentication with ac:86:74:92:fc:8a timed out.
输入
dhclient wlan0
此输入只会永远加载命令。直到我按下 CTRL+C。如果我尝试 ping 我得到ping: unknown host www.google.com
答案1
无线扩展wext
已已弃用有利于nl80211
。
您可以尝试一下命令吗
sudo wpa_supplicant -B -D nl80211 -c /etc/wpa_supplicant.conf -i wlan0
请注意,仅当没有使用 wpa_supplicant 的前端程序(例如网络管理器)已在运行时,按照您想要的方式直接使用 wpa_supplicant 才有效。