atk9k 無法使用 wpa_supplicant 在 ap + 用戶端上設定虛擬設備

atk9k 無法使用 wpa_supplicant 在 ap + 用戶端上設定虛擬設備

我正在嘗試使用運行 ubuntu 14.04 的 Beagle Bone Black 同時充當接入點和無線客戶端,目標是使用接入點允許客戶端連接,透過 httpd 伺服器開啟頁面,然後配置/連接到本地無線訊號

wifi 使用 Atheros AR9271 晶片組,該晶片組使用 ath9k_htc 驅動程式 我想知道這是否特定於該晶片組與標準 ath9k 支援的晶片組,還是我錯過了難以捉摸的明顯現象?

我可以使用虛擬設備讓接入點正常運作

iw phy phy0 interface add wap0 type __ap
ifconfig wap0 hw ether 0a:35:9f:fe:44:01  # or any fake HW address
ifconfig wap0 192.168.8.1 netmask 255.255.255.0
ifconfig wap0 192.168.8.1 up

與 /etc/network/interfaces 條目

auto wap0
iface wap0 inet static
    hostapd /etc/hostapd/hostapd.conf
    address 192.168.8.1
    netmask 255.255.255.0

和 /etc/hostapd/hostapd.conf 項目最少

interface=wap0
driver=nl80211
ssid=BeagleBoneBlack
channel=1

和 /etc/dnsmasq.conf 至少

interface=lo,wap0
listen-address=127.0.0.1
no-dhcp-interface=lo
dhcp-range=192.168.8.10,192.168.8.50,255.255.255.0,12h
cache-size=0

我可以使用各種工具(nmcli / wicd / iw / ...)讓客戶端進行無線連接,然後我可以使用以下命令連接到另一個路由器wlan0

如果停用加密

當我嘗試連接到另一個wpa1/2已啟用的路由器時,我開始在任何客戶端和多個核心/驅動程式版本上得到有趣的結果(透過向後移植 3.19.x 相容 3.8.x)

一切都wpa_supplicant直接運行

wpa_passphrase "NETWORK_SSID" "WPA_PASS_PHRASE" > /etc/wpa_supplicant.conf
wpa_supplicant -i wlan0 -Dwext -Dn180211 -c/etc/wpa_supplicant.conf

輸出(以不同順序重複幾十次)

Successfully initialized wpa_supplicant
wlan0: CTRL-EVENT-SCAN-STARTED 
wlan0: SME: Trying to authenticate with 04:a1:51:33:f3:64 (SSID='NETWORK_SSID' freq=2462 MHz)
wlan0: SME: Authentication request to the driver failed

在初始化虛擬設備之前執行 wpa_supplicant 時wap0

# wpa_supplicant -i wlan0 -Dwext -Dn180211 -c/etc/wpa_supplicant.conf

Successfully initialized wpa_supplicant
wlan0: CTRL-EVENT-SCAN-STARTED 
wlan0: SME: Trying to authenticate with 98:fc:11:b7:48:a0 (SSID='mycomountain' freq=2437 MHz)
wlan0: Trying to associate with 98:fc:11:b7:48:a0 (SSID='NETWORK_SSID' freq=2437 MHz)
wlan0: Associated with 98:fc:11:b7:48:a0
wlan0: WPA: Key negotiation completed with 98:fc:11:b7:48:a0 [PTK=CCMP GTK=TKIP]
wlan0: CTRL-EVENT-CONNECTED - Connection to 98:fc:11:b7:48:a0 completed [id=0 id_str=]

使用 /etc/network/interfaces 設定為

auto wlan0
iface wlan0 inet dhcp
    wpa-ssid "NETWORK_SSID"
    wpa-psk "WPA_PASS_PHRASE"

和跑步

ifdown wlan0; ifup wlan0;

輸出

Internet Systems Consortium DHCP Client 4.2.4
Copyright 2004-2012 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/wlan0/e8:de:27:1f:6e:60
Sending on   LPF/wlan0/e8:de:27:1f:6e:60
Sending on   Socket/fallback
Internet Systems Consortium DHCP Client 4.2.4
Copyright 2004-2012 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/wlan0/e8:de:27:1f:6e:60
Sending on   LPF/wlan0/e8:de:27:1f:6e:60
Sending on   Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 3 (xid=0x39ec90a3)
# ...
No DHCPOFFERS received.
No working leases in persistent database - sleeping.

然後 DHCPDISCOVER 行以各種間隔值重複自身,直到失敗

當 hostapd 在 wap0 上運行時 wicd 無法執行任何操作

我當然跳過了到目前為止我嘗試過的幾個步驟,最好的參考表明我正在做的事情應該有效(如果對任何人有幫助,我可以發布更多的內容,其中包含讓我到目前為止的文章)

在 Linux 中的單一介面上建立 WiFi 存取點

** 編輯 **

我嘗試更改 hostaptd 通道以匹配我嘗試連接的路由器通道 - 仍然沒有連接,但開始讓 wicd 在 hostapd 運行時執行某些操作

透過 python w/ dbus 進行 wicd 控制(可能不相關,但希望一旦找到解決方案,該線程可以幫助其他人)

import dbus

bus = dbus.SystemBus()
wireless = dbus.Interface(bus.get_object('org.wicd.daemon', '/org/wicd/daemon/wireless'),
                          'org.wicd.daemon.wireless')
network_id = 0
wireless.ConnectWireless(network_id)

Wicd日誌輸出

2015/04/20 16:47:30 :: Putting interface down
2015/04/20 16:47:30 :: Releasing DHCP leases...
2015/04/20 16:47:30 :: attempting to set hostname with dhclient
2015/04/20 16:47:30 :: using dhcpcd or another supported client may work better
2015/04/20 16:47:31 :: Setting false IP...
2015/04/20 16:47:31 :: Stopping wpa_supplicant
2015/04/20 16:47:31 :: Flushing the routing table...
2015/04/20 16:47:31 :: Putting interface up...
2015/04/20 16:47:33 :: Attempting to authenticate...
2015/04/20 16:48:09 :: wpa_supplicant authentication may have failed.
2015/04/20 16:48:09 :: connect result is 
2015/04/20 16:48:09 :: exiting connection thread
2015/04/20 16:48:10 :: Sending connection attempt result bad_pass
2015/04/20 16:48:10 :: Autoconnecting...
2015/04/20 16:48:10 :: No wired connection present, attempting to autoconnect to wireless network
2015/04/20 16:48:13 :: Unable to autoconnect, you'll have to manually connect
2015/04/20 16:48:13 :: attempting to set hostname with dhclient
2015/04/20 16:48:13 :: using dhcpcd or another supported client may work better
2015/04/20 16:48:13 :: attempting to set hostname with dhclient
2015/04/20 16:48:13 :: using dhcpcd or another supported client may work better

輸出 wicd --hostapd 已停止

2015/04/20 16:58:58 :: Putting interface down
2015/04/20 16:58:58 :: Releasing DHCP leases...
2015/04/20 16:58:58 :: attempting to set hostname with dhclient
2015/04/20 16:58:58 :: using dhcpcd or another supported client may work better
2015/04/20 16:58:58 :: Setting false IP...
2015/04/20 16:58:58 :: Stopping wpa_supplicant
2015/04/20 16:58:58 :: Flushing the routing table...
2015/04/20 16:58:58 :: Putting interface up...
2015/04/20 16:59:00 :: Attempting to authenticate...
2015/04/20 16:59:02 :: Running DHCP with hostname HOSTNAME
2015/04/20 16:59:02 :: attempting to set hostname with dhclient
2015/04/20 16:59:02 :: using dhcpcd or another supported client may work better
2015/04/20 16:59:02 :: Internet Systems Consortium DHCP Client 4.2.4
2015/04/20 16:59:02 :: Copyright 2004-2012 Internet Systems Consortium.
2015/04/20 16:59:02 :: All rights reserved.
2015/04/20 16:59:02 :: For info, please visit https://www.isc.org/software/dhcp/
2015/04/20 16:59:02 :: 
2015/04/20 16:59:02 :: Listening on LPF/wlan0/64:70:02:20:08:35
2015/04/20 16:59:02 :: Sending on   LPF/wlan0/64:70:02:20:08:35
2015/04/20 16:59:02 :: Sending on   Socket/fallback
2015/04/20 16:59:02 :: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 3 (xid=0x136a5e8e)
2015/04/20 16:59:02 :: DHCPREQUEST of 192.168.0.15 on wlan0 to 255.255.255.255 port 67 (xid=0x136a5e8e)
2015/04/20 16:59:02 :: DHCPOFFER of 192.168.0.15 from 192.168.0.1
2015/04/20 16:59:02 :: DHCPACK of 192.168.0.15 from 192.168.0.1
2015/04/20 16:59:02 :: bound to 192.168.0.15 -- renewal in 42862 seconds.
2015/04/20 16:59:02 :: DHCP connection successful
2015/04/20 16:59:02 :: not verifying
2015/04/20 16:59:03 :: Connecting thread exiting.
2015/04/20 16:59:03 :: Sending connection attempt result success

答案1

不確定您擁有什麼硬件,但如果您使用 USB 記憶棒進行 Wifi(如 TP-Links TL-WN722N),則在沒有韌體破解的情況下無法設定 AP 模式通道。這是一項非常重要的任務,需要編譯一堆 Linux 原始碼等。

相關內容