У меня был рабочий файл hostapd и работающая точка доступа Wi-Fi (устройство - busybox, плата iMX6). Пока точка доступа была запущена и работала, я выполнял ручную маршрутизацию, подключенную к устройству через ssh (я могу подключить это устройство через точку доступа другого устройства, я сначала подключаюсь к точке доступа с помощью своего ПК, а затем ssh в вышеупомянутый устройство). Однако во время моей последней команды ssh застрял, поэтому я решил выключить и выключить.
После выключения питания предыдущие команды (которые работали каждый раз, даже после выключения питания) больше не работают. Вот как я обычно настраиваю точку доступа.
Сначала я бы создал виртуальный интерфейс из wlan0, который активен при запуске.
iw dev wlan0 interface add wlan0_ap2 type managed addr 12:34:56:78:ab:ce
Интерфейс wlan0 также позволяет мне подключаться к этому устройству по ssh. wlan0 подключен к wlan0-ap другой платы. Мой компьютер также подключен к сети wlan0-ap. После ssh'ing в устройство я бы запустил конфигурацию 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)
Хорошо, у меня есть решение,
Поскольку это устройство
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 соответствующим образом решила проблему.