我正在尝试使用运行 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.8.x 到反向移植 3.19.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_supplicantwap0
# 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 无法执行任何操作
我当然跳过了到目前为止尝试过的几个步骤,最好的参考建议我正在做的事情应该有效(如果对任何人都有帮助,我可以发布另外十几个让我走到这一步的文章)
** 编辑 **
我尝试更改 hostaptd 通道以匹配我尝试连接的路由器通道 - 仍然无法连接,但当 hostapd 运行时,wicd 开始执行某些操作
通过 python 和 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 ceases to be checked
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 源代码等。此外,默认固件似乎适用于没有通道 12 和 13 的国家/地区。