Networking

wpa_supplicant 表示網路已禁用

  • August 22, 2018

當嘗試使用wpa_supplicantGentoo Linux 連接到網路(特別是大學的 WPA2 企業網路)時,如果未設置該標誌,則網路顯示為禁用。

我的wpa_supplicant.conf

ctrl_interface=/var/run/wpa_supplicant

network={
   ssid="TheNetwork"
   eap=PEAP
   identity="redacted"
   password="redacted"
   ca_cert="/etc/ssl/certs/AddTrust_External_Root.pem"
   ca_path="/etc/ssl/certs/"
   phase1="peapver=0"
   phase2="auth=MSCHAPV2"
}

network={
   ssid="Another network that works"
   key_mgmt=NONE
   disabled=1 # This is obviously not normally disabled
}

network={
   ssid="Yet another working network"
   psk="redacted"
   disabled=1 # Likewise
}

的輸出sudo wpa_supplicant -iwlp3s0 -c/etc/wpa_supplicant/wpa_supplicant.conf -d,刪除了重複的行:

wpa_supplicant v2.6
random: Trying to read entropy from /dev/random
Successfully initialized wpa_supplicant
Initializing interface 'wlp3s0' conf '/etc/wpa_supplicant/wpa_supplicant.conf' driver 'default' ctrl_interface 'N/A' bridge 'N/A'
Configuration file '/etc/wpa_supplicant/wpa_supplicant.conf' -> '/etc/wpa_supplicant/wpa_supplicant.conf'
Reading configuration file '/etc/wpa_supplicant/wpa_supplicant.conf'
ctrl_interface='/var/run/wpa_supplicant'
   Priority group 0
  id=0 ssid='TheNetwork'
  id=1 ssid='Another network that works'
  id=2 ssid='Yet another working network'
nl80211: Supported cipher 00-0f-ac:1
...
nl80211: Supported cipher 00-0f-ac:9
nl80211: Using driver-based off-channel TX
nl80211: Driver-advertised extended capabilities (default) - hexdump(len=8): 00 00 00 00 00 00 00 40
nl80211: Driver-advertised extended capabilities mask (default) - hexdump(len=8): 00 00 00 00 00 00 00 40
nl80211: interface wlp3s0 in phy phy0
nl80211: Set mode ifindex 4 iftype 2 (STATION)
nl80211: Subscribe to mgmt frames with non-AP handle 0x55701974e5f0
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x55701974e5f0 match=0104
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x55701974e5f0 match=040a
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x55701974e5f0 match=040b
...
rfkill: initial event: idx=1 type=1 op=0 soft=0 hard=0
netlink: Operstate: ifindex=4 linkmode=1 (userspace-control), operstate=5 (IF_OPER_DORMANT)
Add interface wlp3s0 to a new radio phy0
nl80211: Regulatory information - country=US (DFS-FCC)
nl80211: 2402-2472 @ 40 MHz 30 mBm
nl80211: 5170-5250 @ 80 MHz 23 mBm
nl80211: 5250-5330 @ 80 MHz 23 mBm (DFS)
nl80211: 5490-5730 @ 160 MHz 23 mBm (DFS)
nl80211: 5735-5835 @ 80 MHz 30 mBm
nl80211: 57240-63720 @ 2160 MHz 40 mBm
nl80211: Added 802.11b mode based on 802.11g information
wlp3s0: Own MAC address: [redacted]
wpa_driver_nl80211_set_key: ifindex=4 (wlp3s0) alg=0 addr=(nil) key_idx=0 set_tx=0 seq_len=0 key_len=0
...
wpa_driver_nl80211_set_key: ifindex=4 (wlp3s0) alg=0 addr=(nil) key_idx=5 set_tx=0 seq_len=0 key_len=0
wlp3s0: RSN: flushing PMKID list in the driver
nl80211: Flush PMKIDs
wlp3s0: No enabled networks (3 disabled networks)
wlp3s0: State: DISCONNECTED -> INACTIVE
ENGINE: Loading dynamic engine
ENGINE: Loading dynamic engine
EAPOL: SUPP_PAE entering state DISCONNECTED
EAPOL: Supplicant port status: Unauthorized
nl80211: Skip set_supp_port(unauthorized) while not associated
EAPOL: KEY_RX entering state NO_KEY_RECEIVE
EAPOL: SUPP_BE entering state INITIALIZE
EAP: EAP entering state DISABLED
Using existing control interface directory.
ctrl_iface bind(PF_UNIX) failed: Address already in use
ctrl_iface exists, but does not allow connections - assuming it was leftover from forced program termination
Successfully replaced leftover ctrl_iface socket '/var/run/wpa_supplicant/wlp3s0'
wlp3s0: Added interface wlp3s0
wlp3s0: State: INACTIVE -> DISCONNECTED
nl80211: Set wlp3s0 operstate 0->0 (DORMANT)
netlink: Operstate: ifindex=4 linkmode=-1 (no change), operstate=5 (IF_OPER_DORMANT)
random: Got 20/20 bytes from /dev/random
EAPOL: disable timer tick

令我印象深刻的是這條線wlp3s0: No enabled networks (3 disabled networks)。儘管顯然只有兩個禁用的網路,但還是會出現這種情況。儘管缺少標誌,但第一個網路被禁用的進一步證據是,在啟用disabled=1其他兩個網路的情況下執行 wpa_supplement 命令時,會執行掃描並輸出,但所有相關 AP 都被跳過為“禁用”、“SSID 不匹配” ”和“SSID 不匹配”,即使 SSID 明顯匹配。在移除其他兩個網路的情況下執行 wpa_supplicant 時,會出現該行。wlp3s0: No enabled networks (1 disabled networks)

配置中的什麼導致這種情況發生?

在 中聲明network塊時wpa_supplicant.conf,預設值為(設置為key_mgmt,定義。稍後,當檢查網路是否“禁用”時,其中一項檢查是檢查該塊是否設置但未設置WPA-PSK IEEE8021Xconfig.c``DEFAULT_KEY_MGMTDEFAULT_KEY_MGMTkey_mgmt=WPA-PSK``psk=

因此,您的網路塊存在兩個問題。

  1. wpa_supplicant甚至不會嘗試進行 PEAP 身份驗證,因為您沒有key_mgmt=WPA-EAP. 我自己無法對此進行測試,但您在評論中提到設置此設置有幫助。
  2. 由於您使用的是預設值key_mgmt=WPA-PSK IEEE8021X,因此您的塊將被視為已禁用,因為您尚未設置psk。顯然,第二個問題並不是您真正關心的問題,因為您打算使用 PEAP ;-)。

基於wpa_supplicant-2.6.

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