Wpa-Supplicant

使用 wpa_supplicant 設置 WPA2 個人的問題

  • June 4, 2016

系統:archlinux(最後更新)

我插入了一個 USB 無線加密狗,基本的東西似乎開箱即用,但是我似乎無法正確配置 wpa_supplicant 以獲得連接。它總是告訴我我可能有一個錯誤的密鑰 - 我知道我沒有,因為這是我在其他系統中使用的,所以我肯定缺少一些東西。

我使用 MAC 過濾,但設置正確。

我可以檢查我的界面

> iw dev
phy#0
   Interface wlp0s29f0u1
       ifindex 3
       wdev 0x1
       addr <<mywirelessmac>>
       type managed

我可以掃描可用的網路

> iw dev wlp0s29f0u1 scan

該命令提供了許多與我的其他系統相匹配的結果和資訊。包括我的 ssid:

BSS <<mywirelessroutermac>>(on wlp0s29f0u1)
   TSF: 5596476527 usec (0d, 01:33:16)
   freq: 2412
   beacon interval: 200 TUs
   capability: ESS Privacy ShortSlotTime (0x0411)
   signal: -65.00 dBm
   last seen: 1430 ms ago
   Information elements from Probe Response frame:
   SSID: <<myssid>>
   Supported rates: 1.0* 2.0* 5.5* 11.0* 6.0 9.0 12.0 18.0 
   DS Parameter set: channel 1
   Country: GB Environment: Indoor/Outdoor
       Channels [1 - 13] @ 20 dBm
   ERP: Barker_Preamble_Mode
   Extended supported rates: 24.0 36.0 48.0 54.0 
   HT capabilities:
       Capabilities: 0x1ad
           RX LDPC
           HT20
           SM Power Save disabled
           RX HT20 SGI
           TX STBC
           RX STBC 1-stream
           Max AMSDU length: 3839 bytes
           No DSSS/CCK HT40
       Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
       Minimum RX AMPDU time spacing: No restriction (0x00)
       HT TX/RX MCS rate indexes supported: 0-15
   HT operation:
        * primary channel: 1
        * secondary channel offset: no secondary
        * STA channel width: 20 MHz
        * RIFS: 0
        * HT protection: non-HT mixed
        * non-GF present: 1
        * OBSS non-GF present: 1
        * dual beacon: 0
        * dual CTS protection: 0
        * STBC beacon: 0
        * L-SIG TXOP Prot: 0
        * PCO active: 0
        * PCO phase: 0
   Overlapping BSS scan params:
        * passive dwell: 20 TUs
        * active dwell: 10 TUs
        * channel width trigger scan interval: 300 s
        * scan passive total per channel: 200 TUs
        * scan active total per channel: 20 TUs
        * BSS width channel transition delay factor: 5
        * OBSS Scan Activity Threshold: 0.25 %
   Extended capabilities: HT Information Exchange Supported, 6
   WMM:     * Parameter version 1
        * u-APSD
        * BE: CW 15-1023, AIFSN 3
        * BK: CW 15-1023, AIFSN 7
        * VI: CW 7-15, AIFSN 2, TXOP 3008 usec
        * VO: CW 3-7, AIFSN 2, TXOP 1504 usec
   RSN:     * Version: 1
        * Group cipher: CCMP
        * Pairwise ciphers: CCMP
        * Authentication suites: PSK
        * Capabilities: 1-PTKSA-RC 1-GTKSA-RC (0x0000)

我有一個基本的個人資料:

> cat /etc/wpa_supplicant/wpa.conf
ctrl_interface=/var/run/wpa_supplicant
update_config=1

network={
   ssid="<<ssid>>"
   psk=<<either "mypassphrase" or [the result of wpa_passphrase ssid passphrase] neither works>>
   key_mgmt=WPA-PSK # I tried without, same result
   ieee80211w=1 # I tried without (both), same result
}

我嘗試了兩種方法來啟動 wpa_supplicant,結果完全相同:

> wpa_supplicant -B -Dnl80211 -iwlp0s29f0u1 -c /etc/wpa_supplicant/wpa.conf
Successfully initialized wpa_supplicant

(殺死 -9 並重新啟動)

> wpa_supplicant -B -Dnl80211,wext -iwlp0s29f0u1 -c /etc/wpa_supplicant/wpa.conf
Successfully initialized wpa_supplicant

現在來看看這兩種情況會發生什麼:

> wpa_cli
> scan
> scan_results
<<mac>> 2412    -65 [WPA2-PSK-CCMP][ESS]    <<ssid>>
<3>CTRL-EVENT-SCAN-STARTED 
<3>CTRL-EVENT-SCAN-RESULTS 
<3>WPS-AP-AVAILABLE 
<3>CTRL-EVENT-SSID-REENABLED id=0 ssid="<<ssid>>"
<3>SME: Trying to authenticate with <<mac>> (SSID='<<ssid>>' freq=2412 MHz)
<3>Trying to associate with <<mac>> (SSID='<<ssid>>' freq=2412 MHz)
<3>Associated with <<mac>>
<4>WPA: Failed to set PTK to the driver (alg=3 keylen=16 bssid=<<mac>>)
<3>CTRL-EVENT-DISCONNECTED bssid=<<mac>> reason=1 locally_generated=1
<3>WPA: 4-Way Handshake failed - pre-shared key may be incorrect
<3>CTRL-EVENT-SSID-TEMP-DISABLED id=0 ssid="<<ssid>>" auth_failures=<x> duration=<xx> reason=WRONG_KEY
<3>CTRL-EVENT-SCAN-STARTED 
<3>CTRL-EVENT-SCAN-RESULTS 
<3>WPS-AP-AVAILABLE 

有兩件事跳出來:

<4>WPA: Failed to set PTK to the driver (alg=3 keylen=16 bssid=<<mac>>)
<3>CTRL-EVENT-SSID-TEMP-DISABLED id=0 ssid="<<ssid>>" auth_failures=<x> duration=<xx> reason=WRONG_KEY

我相信第二個是第一個的症狀。

所以我真正的問題是理解我的設置有什麼問題,它會生成第一條錯誤消息。這就是我希望得到一點幫助的地方。

謝謝。

糟糕,似乎重新啟動我的系統可以解決問題。

感謝一路上的幫助。

引用自:https://unix.stackexchange.com/questions/287577