hostapd 不再工作

hostapd 不再工作

我有一个可以正常工作的 hostapd 文件和一个正常运行的 wifi 热点(设备是 busybox,iMX6 主板)。热点启动并运行时,我通过 ssh 手动路由连接到设备(我可以通过另一台设备的接入点连接此设备,我首先使用我的 PC 连接到接入点,然后 ssh 进入上述设备)。但是,在我执行最后一个命令时,ssh 卡住了,因此我决定关闭电源。

电源循环后,以前的命令(以前每次都有效,即使在电源循环后)不再有效。以下是我通常设置热点的方式。

首先,我将从 wlan0 创建一个虚拟接口,该接口在启动时处于活动状态。

iw dev wlan0 interface add wlan0_ap2 type managed addr 12:34:56:78:ab:ce

wlan0 接口还允许我通过 ssh 进入此设备。wlan0 连接到另一块主板的 wlan0-ap。我的 PC 也连接到 wlan0-ap 网络。通过 ssh 进入设备后,我将启动 hostapd 配置,如下所示:

hostapd -dd /etc/hostapd_build_ap.conf

此后,外部设备即可检测到并连接热停止。我通常不设置 dhcp 服务器,静态 IP 对我来说没问题。

这是 hostapd_build_ap.conf 文件:

interface=wlan0_ap2
#bridge=br0
ssid=myhotspot
driver=nl80211
country_code=US
hw_mode=g
channel=10
max_num_sta=5
wpa=2
auth_algs=1
wpa_passphrase=ABABABABAB
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

通过“路线添加...”完成某些路线后

我通常能够将两个设备用作相互连接的接入点。然而,在我上次路由之后,就像我说的,ssh 没有响应,我不得不关闭电源。(目前没有其他方式可以访问该设备)

现在,当我尝试启动 hostapd 时,我得到了这个:

random: Trying to read entropy from /dev/random
Configuration file: /etc/hostapd_build_ap.conf
rfkill: Cannot open RFKILL control device
nl80211: RFKILL status not available
nl80211: TDLS supported
nl80211: TDLS external setup
nl80211: Supported cipher 00-0f-ac:1
nl80211: Supported cipher 00-0f-ac:5
nl80211: Supported cipher 00-0f-ac:2
nl80211: Supported cipher 00-0f-ac:4
nl80211: Supported cipher 00-0f-ac:10
nl80211: Supported cipher 00-0f-ac:8
nl80211: Supported cipher 00-0f-ac:9
nl80211: Supported cipher 00-0f-ac:6
nl80211: Supported cipher 00-0f-ac:13
nl80211: Supported cipher 00-0f-ac:11
nl80211: Supported cipher 00-0f-ac:12
nl80211: Using driver-based off-channel TX
nl80211: Use separate P2P group interface (driver advertised support)
nl80211: interface wlan0_ap2 in phy phy0
nl80211: Set mode ifindex 4 iftype 3 (AP)
nl80211: Setup AP(wlan0_ap2) - device_ap_sme=0 use_monitor=0
nl80211: Subscribe to mgmt frames with AP handle 0x57d950
nl80211: Register frame type=0xb0 (WLAN_FC_STYPE_AUTH) nl_handle=0x57d950 match=
nl80211: Register frame type=0x0 (WLAN_FC_STYPE_ASSOC_REQ) nl_handle=0x57d950 match=
nl80211: Register frame type=0x20 (WLAN_FC_STYPE_REASSOC_REQ) nl_handle=0x57d950 match=
nl80211: Register frame type=0xa0 (WLAN_FC_STYPE_DISASSOC) nl_handle=0x57d950 match=
nl80211: Register frame type=0xc0 (WLAN_FC_STYPE_DEAUTH) nl_handle=0x57d950 match=
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x57d950 match=
nl80211: Register frame type=0x40 (WLAN_FC_STYPE_PROBE_REQ) nl_handle=0x57d950 match=
nl80211: Add own interface ifindex 4
nl80211: if_indices[16]: 4
phy: phy0
BSS count 1, BSSID mask 00:00:00:00:00:00 (0 bits)
wlan0_ap2: interface state UNINITIALIZED->COUNTRY_UPDATE
Previous country code 98, new country code US 
Continue interface setup after channel list update
ctrl_iface not configured!
random: Got 20/20 bytes from /dev/random
nl80211: Event message available
nl80211: BSS Event 59 (NL80211_CMD_FRAME) received for wlan0_ap2
nl80211: MLME event 59 (NL80211_CMD_FRAME) on wlan0_ap2(12:34:56:78:ab:ce) A1=ff:ff:ff:ff:ff:ff A2=bc:a9:20:47:0d:ee
nl80211: MLME event frame - hexdump(len=130): 40 00 00 00 ff ff ff ff ff ff bc a9 20 47 0d ee ff ff ff ff ff ff d0 6d 00 04 41 52 4f 58 01 04 02 04 0b 16 32 08 0c 12 18 24 30 48 60 6c 03 01 0b 2d 1a 21 40 17 ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7f 08 04 00 08 84 00 00 00 40 6b 07 0f ff ff ff ff ff ff dd 0b 00 17 f2 0a 00 01 04 00 00 00 00 dd 08 00 50 f2 08 00 0e 00 00 dd 09 00 10 18 02 01 00 10 00 00
nl80211: Frame event
nl80211: RX frame sa=bc:a9:20:47:0d:ee freq=2462 ssi_signal=-43 fc=0x40 seq_ctrl=0x6dd0 stype=4 (WLAN_FC_STYPE_PROBE_REQ) len=130
nl80211: Event message available
nl80211: BSS Event 59 (NL80211_CMD_FRAME) received for wlan0_ap2
nl80211: MLME event 59 (NL80211_CMD_FRAME) on wlan0_ap2(12:34:56:78:ab:ce) A1=ff:ff:ff:ff:ff:ff A2=bc:a9:20:47:0d:ee
nl80211: MLME event frame - hexdump(len=130): 40 00 00 00 ff ff ff ff ff ff bc a9 20 47 0d ee ff ff ff ff ff ff f0 6d 00 04 41 52 4f 58 01 04 02 04 0b 16 32 08 0c 12 18 24 30 48 60 6c 03 01 0b 2d 1a 21 40 17 ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7f 08 04 00 08 84 00 00 00 40 6b 07 0f ff ff ff ff ff ff dd 0b 00 17 f2 0a 00 01 04 00 00 00 00 dd 08 00 50 f2 08 00 0e 00 00 dd 09 00 10 18 02 01 00 10 00 00
nl80211: Frame event
nl80211: RX frame sa=bc:a9:20:47:0d:ee freq=2462 ssi_signal=-43 fc=0x40 seq_ctrl=0x6df0 stype=4 (WLAN_FC_STYPE_PROBE_REQ) len=130
nl80211: Event message available
nl80211: BSS Event 59 (NL80211_CMD_FRAME) received for wlan0_ap2
nl80211: MLME event 59 (NL80211_CMD_FRAME) on wlan0_ap2(12:34:56:78:ab:ce) A1=ff:ff:ff:ff:ff:ff A2=bc:a9:20:47:0d:ee
nl80211: MLME event frame - hexdump(len=130): 40 00 00 00 ff ff ff ff ff ff bc a9 20 47 0d ee ff ff ff ff ff ff 00 6e 00 04 41 52 4f 58 01 04 02 04 0b 16 32 08 0c 12 18 24 30 48 60 6c 03 01 0b 2d 1a 21 40 17 ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7f 08 04 00 08 84 00 00 00 40 6b 07 0f ff ff ff ff ff ff dd 0b 00 17 f2 0a 00 01 04 00 00 00 00 dd 08 00 50 f2 08 00 0e 00 00 dd 09 00 10 18 02 01 00 10 00 00
nl80211: Frame event
nl80211: RX frame sa=bc:a9:20:47:0d:ee freq=2462 ssi_signal=-37 fc=0x40 seq_ctrl=0x6e00 stype=4 (WLAN_FC_STYPE_PROBE_REQ) len=130
nl80211: Event message available
nl80211: BSS Event 59 (NL80211_CMD_FRAME) received for wlan0_ap2
nl80211: MLME event 59 (NL80211_CMD_FRAME) on wlan0_ap2(12:34:56:78:ab:ce) A1=ff:ff:ff:ff:ff:ff A2=bc:a9:20:47:0d:ee
nl80211: MLME event frame - hexdump(len=130): 40 00 00 00 ff ff ff ff ff ff bc a9 20 47 0d ee ff ff ff ff ff ff 50 6e 00 04 41 52 4f 58 01 04 02 04 0b 16 32 08 0c 12 18 24 30 48 60 6c 03 01 0b 2d 1a 21 40 17 ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7f 08 04 00 08 84 00 00 00 40 6b 07 0f ff ff ff ff ff ff dd 0b 00 17 f2 0a 00 01 04 00 00 00 00 dd 08 00 50 f2 08 00 0e 00 00 dd 09 00 10 18 02 01 00 10 00 00
nl80211: Frame event
nl80211: RX frame sa=bc:a9:20:47:0d:ee freq=2462 ssi_signal=-41 fc=0x40 seq_ctrl=0x6e50 stype=4 (WLAN_FC_STYPE_PROBE_REQ) len=130
Channel list update timeout - try to continue anyway
nl80211: Regulatory information - country=98
nl80211: 2402-2482 @ 40 MHz 20 mBm
nl80211: 5170-5250 @ 80 MHz 23 mBm
nl80211: 5250-5330 @ 80 MHz 23 mBm (DFS)
nl80211: 5735-5835 @ 80 MHz 30 mBm
nl80211: Added 802.11b mode based on 802.11g information
Allowed channel: mode=1 chan=1 freq=2412 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=2 freq=2417 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=3 freq=2422 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=4 freq=2427 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=5 freq=2432 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=6 freq=2437 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=7 freq=2442 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=8 freq=2447 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=9 freq=2452 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=10 freq=2457 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=11 freq=2462 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=12 freq=2467 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=13 freq=2472 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=1 freq=2412 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=2 freq=2417 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=3 freq=2422 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=4 freq=2427 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=5 freq=2432 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=6 freq=2437 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=7 freq=2442 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=8 freq=2447 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=9 freq=2452 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=10 freq=2457 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=11 freq=2462 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=12 freq=2467 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=13 freq=2472 MHz max_tx_power=20 dBm
Completing interface initialization
Mode: IEEE 802.11g  Channel: 10  Frequency: 2457 MHz
DFS 0 channels required radar detection
nl80211: Set freq 2457 (ht_enabled=0, vht_enabled=0, bandwidth=20 MHz, cf1=2457 MHz, cf2=0 MHz)
  * freq=2457
  * vht_enabled=0
  * ht_enabled=0
RATE[0] rate=10 flags=0x1
RATE[1] rate=20 flags=0x1
RATE[2] rate=55 flags=0x1
RATE[3] rate=110 flags=0x1
RATE[4] rate=60 flags=0x0
RATE[5] rate=90 flags=0x0
RATE[6] rate=120 flags=0x0
RATE[7] rate=180 flags=0x0
RATE[8] rate=240 flags=0x0
RATE[9] rate=360 flags=0x0
RATE[10] rate=480 flags=0x0
RATE[11] rate=540 flags=0x0
hostapd_setup_bss(hapd=0x57cf48 (wlan0_ap2), first=1)
wlan0_ap2: Flushing old station entries
nl80211: flush -> DEL_STATION wlan0_ap2 (all)
wlan0_ap2: Deauthenticate all stations
nl80211: send_mlme - da= ff:ff:ff:ff:ff:ff noack=0 freq=0 no_cck=0 offchanok=0 wait_time=0 fc=0xc0 (WLAN_FC_STYPE_DEAUTH) nlmode=3
nl80211: send_mlme -> send_frame
nl80211: send_frame - Use bss->freq=2457
nl80211: send_frame -> send_frame_cmd
nl80211: CMD_FRAME freq=2457 wait=0 no_cck=0 no_ack=0 offchanok=0
CMD_FRAME - hexdump(len=26): c0 00 00 00 ff ff ff ff ff ff 12 34 56 78 ab ce 12 34 56 78 ab ce 00 00 02 00
nl80211: Frame command failed: ret=-16 (Device or resource busy) (freq=2457 wait=0)
wpa_driver_nl80211_set_key: ifindex=4 (wlan0_ap2) alg=0 addr=(nil) key_idx=0 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=4 (wlan0_ap2) alg=0 addr=(nil) key_idx=1 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=4 (wlan0_ap2) alg=0 addr=(nil) key_idx=2 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=4 (wlan0_ap2) alg=0 addr=(nil) key_idx=3 set_tx=0 seq_len=0 key_len=0
Using interface wlan0_ap2 with hwaddr 12:34:56:78:ab:ce and ssid "myhotspot"
Deriving WPA PSK based on passphrase
SSID - hexdump_ascii(len=9):
     6d 79 68 6f 74 73 70 6f 74                        myhotspot       
PSK (ASCII passphrase) - hexdump_ascii(len=10): [REMOVED]
PSK (from passphrase) - hexdump(len=32): [REMOVED]
Get randomness: len=32 entropy=108
GMK - hexdump(len=32): [REMOVED]
Get randomness: len=32 entropy=76
Key Counter - hexdump(len=32): [REMOVED]
WPA: Delay group state machine start until Beacon frames have been configured
nl80211: Set beacon (beacon_set=0)
nl80211: Beacon head - hexdump(len=60): 80 00 00 00 ff ff ff ff ff ff 12 34 56 78 ab ce 12 34 56 78 ab ce 00 00 00 00 00 00 00 00 00 00 64 00 11 04 00 09 6d 79 68 6f 74 73 70 6f 74 01 08 82 84 8b 96 0c 12 18 24 03 01 0a
nl80211: Beacon tail - hexdump(len=41): 2a 01 04 32 04 30 48 60 6c 30 14 01 00 00 0f ac 04 01 00 00 0f ac 04 01 00 00 0f ac 02 00 00 7f 08 00 00 00 00 00 00 00 40
nl80211: ifindex=4
nl80211: beacon_int=100
nl80211: dtim_period=2
nl80211: ssid - hexdump_ascii(len=9):
     6d 79 68 6f 74 73 70 6f 74                        myhotspot       
  * beacon_int=100
nl80211: hidden SSID not in use
nl80211: privacy=1
nl80211: auth_algs=0x1
nl80211: wpa_version=0x2
nl80211: key_mgmt_suites=0x2
nl80211: pairwise_ciphers=0x18
nl80211: group_cipher=0x10
nl80211: SMPS mode - off
nl80211: beacon_ies - hexdump(len=10): 7f 08 00 00 00 00 00 00 00 40
nl80211: proberesp_ies - hexdump(len=10): 7f 08 00 00 00 00 00 00 00 40
nl80211: assocresp_ies - hexdump(len=10): 7f 08 00 00 00 00 00 00 00 40
nl80211: Beacon set failed: -16 (Device or resource busy)
Failed to set beacon parameters
wlan0_ap2: Flushing old station entries
nl80211: flush -> DEL_STATION wlan0_ap2 (all)
wlan0_ap2: Deauthenticate all stations
nl80211: send_mlme - da= ff:ff:ff:ff:ff:ff noack=0 freq=0 no_cck=0 offchanok=0 wait_time=0 fc=0xc0 (WLAN_FC_STYPE_DEAUTH) nlmode=3
nl80211: send_mlme -> send_frame
nl80211: send_frame - Use bss->freq=2457
nl80211: send_frame -> send_frame_cmd
nl80211: CMD_FRAME freq=2457 wait=0 no_cck=0 no_ack=0 offchanok=0
CMD_FRAME - hexdump(len=26): c0 00 00 00 ff ff ff ff ff ff 12 34 56 78 ab ce 12 34 56 78 ab ce 00 00 03 00
nl80211: Frame command failed: ret=-16 (Device or resource busy) (freq=2457 wait=0)
wpa_driver_nl80211_set_key: ifindex=4 (wlan0_ap2) alg=0 addr=(nil) key_idx=0 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=4 (wlan0_ap2) alg=0 addr=(nil) key_idx=1 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=4 (wlan0_ap2) alg=0 addr=(nil) key_idx=2 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=4 (wlan0_ap2) alg=0 addr=(nil) key_idx=3 set_tx=0 seq_len=0 key_len=0
hostapd_free_hapd_data(wlan0_ap2)
Interface initialization failed
wlan0_ap2: interface state COUNTRY_UPDATE->DISABLED
wlan0_ap2: AP-DISABLED 
hostapd_interface_deinit_free(0x57c308)
hostapd_interface_deinit_free: num_bss=1 conf->num_bss=1
hostapd_interface_deinit(0x57c308)
wlan0_ap2: interface state DISABLED->DISABLED
hostapd_bss_deinit: deinit bss wlan0_ap2
wlan0_ap2: Deauthenticate all stations
nl80211: send_mlme - da= ff:ff:ff:ff:ff:ff noack=0 freq=0 no_cck=0 offchanok=0 wait_time=0 fc=0xc0 (WLAN_FC_STYPE_DEAUTH) nlmode=3
nl80211: send_mlme -> send_frame
nl80211: send_frame - Use bss->freq=2457
nl80211: send_frame -> send_frame_cmd
nl80211: CMD_FRAME freq=2457 wait=0 no_cck=0 no_ack=0 offchanok=0
CMD_FRAME - hexdump(len=26): c0 00 00 00 ff ff ff ff ff ff 12 34 56 78 ab ce 12 34 56 78 ab ce 00 00 03 00
nl80211: Frame command failed: ret=-16 (Device or resource busy) (freq=2457 wait=0)
wlan0_ap2: AP-DISABLED 
hostapd_cleanup(hapd=0x57cf48 (wlan0_ap2))
hostapd_free_hapd_data: Interface wlan0_ap2 wasn't started
hostapd_interface_deinit_free: driver=0x977b0 drv_priv=0x57d818 -> hapd_deinit
nl80211: deinit ifname=wlan0_ap2 disabled_11b_rates=0
nl80211: Remove monitor interface: refcount=0
nl80211: Remove beacon (ifindex=4)
netlink: Operstate: ifindex=4 linkmode=0 (kernel-control), operstate=6 (IF_OPER_UP)
nl80211: Set mode ifindex 4 iftype 2 (STATION)
nl80211: Teardown AP(wlan0_ap2) - device_ap_sme=0 use_monitor=0
nl80211: Unsubscribe mgmt frames handle 0x88df51d9 (AP teardown)
hostapd_interface_free(0x57c308)
hostapd_interface_free: free hapd 0x57cf48
hostapd_cleanup_iface(0x57c308)
hostapd_cleanup_iface_partial(0x57c308)
hostapd_cleanup_iface: free iface=0x57c308

可能是因为 hostapd 在电源循环期间损坏了?这可能是什么原因造成的?

问题是不是从这里开始的?

nl80211: Frame command failed: ret=-16 (Device or resource busy) (freq=2457 wait=0)

答案1

我也遇到了这个问题,但就我而言,是另一个配置选项导致了这个问题。也就是说,我试图设置 WPA3+WPA2,包括使用带 SHA256 的 WPA2,所以我设置了:

wpa_pairwise=CCMP CCMP-256

也许我的无线网卡不支持后者,所以我得到了资源繁忙的错误。删除后CCMP-256它又可以正常工作了。

答案2

好吧,我找到解决办法了,

由于该设备具有

valid interface combinations:
         * #{ managed } <= 2048, #{ AP } <= 8, #{ P2P-client, P2P-GO } <= 1,
           total <= 2048, #channels <= 1, STA/AP BI must match

具体来说,

#channels <= 1

AP和wlan0必须共享同一个信道。

我使用以下方法检查了 wlan0 的通道

iw wlan0 info

结果发现它切换到了频道 11。因此,相应地配置 hostapd 文件就解决了问题。

相关内容