无法让 BananaPi 启动接入点

无法让 BananaPi 启动接入点

我有一块装有 Ubuntu 16.04 V1.1 操作系统的 Banana Pi M2+ 主板。我正尝试将该设备用作接入点。我尝试了 Google 上的所有方法,但仍然无法启动 AP。

我已经发布系统文件供您查看...

ifconfig:

eth0      Link encap:Ethernet  HWaddr 1e:2b:5e:6d:88:af
          inet addr:192.168.55.227  Bcast:192.168.55.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:34745 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3569 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:4189588 (4.1 MB)  TX bytes:479249 (479.2 KB)
          Interrupt:114

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:20 errors:0 dropped:0 overruns:0 frame:0
          TX packets:20 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1277 (1.2 KB)  TX bytes:1277 (1.2 KB)

wlan0     Link encap:Ethernet  HWaddr b0:f1:ec:2c:ea:c6
          inet addr:172.24.1.1  Bcast:172.24.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:37 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:4640 (4.6 KB)

wlan1     Link encap:Ethernet  HWaddr c2:25:e9:25:ab:14
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

我使用 wlan0 作为 AP,使用 wlan1 作为站。

/etc/网络/接口

auto lo
    iface lo inet loopback

auto eth0
    iface eth0 inet static
    address 192.168.55.227
    netmask 255.255.255.0
    network 192.168.55.0
    broadcast 192.168.55.255
    gateway 192.168.55.1
    dns-nameservers 192.168.55.1

auto wlan0
    iface wlan0 inet static
    hostapd /etc/hostapd/hostapd.conf
    address 172.24.1.1
    netmask 255.255.255.0
    network 172.24.1.0
    broadcast 172.24.1.255

allow-hotplug wlan1
    iface wlan1 inet dhcp
    wpa-ssid "hotspot"
    wpa-psk "passkey1234"

/etc/hostapd/hostapd.conf

interface=wlan0
driver=wl
auth_algs=1
ssid=FreeOpenWifi
channel=1
hw_mode=g
country_code=IN

/etc/dnsmasq.conf

interface=wlan0
bind-interfaces
no-resolv
dhcp-range=172.24.1.50,172.24.1.150,255.255.255.0,12h

做事

systemctl restart hostapd
systemctl restart dnsmasq

我没有收到任何错误。

Output of journalctl -xe

-- Subject: Unit dnsmasq.service has begun shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit dnsmasq.service has begun shutting down.
Nov 23 21:23:41 bpi-iot-ros-ai dnsmasq[5808]: exiting on receipt of SIGTERM
Nov 23 21:23:42 bpi-iot-ros-ai systemd[1]: Stopped dnsmasq - A lightweight DHCP an
-- Subject: Unit dnsmasq.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit dnsmasq.service has finished shutting down.
Nov 23 21:23:42 bpi-iot-ros-ai systemd[1]: Starting dnsmasq - A lightweight DHCP a
-- Subject: Unit dnsmasq.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit dnsmasq.service has begun starting up.
Nov 23 21:23:42 bpi-iot-ros-ai dnsmasq[12380]: dnsmasq: syntax check OK.
Nov 23 21:23:42 bpi-iot-ros-ai dnsmasq[12401]: started, version 2.75 cachesize      
-- Subject: Unit dnsmasq.service has begun shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit dnsmasq.service has begun shutting down.
Nov 23 21:23:41 bpi-iot-ros-ai dnsmasq[5808]: exiting on receipt of SIGTERM
Nov 23 21:23:42 bpi-iot-ros-ai systemd[1]: Stopped dnsmasq - A lightweight DHCP and caching DNS server.
-- Subject: Unit dnsmasq.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit dnsmasq.service has finished shutting down.
Nov 23 21:23:42 bpi-iot-ros-ai systemd[1]: Starting dnsmasq - A lightweight DHCP and caching DNS server...
-- Subject: Unit dnsmasq.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit dnsmasq.service has begun starting up.
Nov 23 21:23:42 bpi-iot-ros-ai dnsmasq[12380]: dnsmasq: syntax check OK.
Nov 23 21:23:42 bpi-iot-ros-ai dnsmasq[12401]: started, version 2.75 cachesize 150
Nov 23 21:23:42 bpi-iot-ros-ai dnsmasq[12401]: compile time options: IPv6 GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset auth DNSSEC loop-detect inoti
Nov 23 21:23:42 bpi-iot-ros-ai dnsmasq[12401]: warning: ignoring resolv-file flag because no-resolv is set
Nov 23 21:23:42 bpi-iot-ros-ai dnsmasq-dhcp[12401]: DHCP, IP range 172.24.1.50 -- 172.24.1.150, lease time 12h
Nov 23 21:23:42 bpi-iot-ros-ai dnsmasq-dhcp[12401]: DHCP, IP range 172.24.1.50 -- 172.24.1.150, lease time 12h
Nov 23 21:23:42 bpi-iot-ros-ai dnsmasq-dhcp[12401]: DHCP, sockets bound exclusively to interface wlan0
Nov 23 21:23:42 bpi-iot-ros-ai dnsmasq[12401]: using nameserver 8.8.8.8#53
Nov 23 21:23:42 bpi-iot-ros-ai dnsmasq[12401]: using nameserver 8.8.8.8#53
Nov 23 21:23:42 bpi-iot-ros-ai dnsmasq[12401]: read /etc/hosts - 7 addresses
Nov 23 21:23:53 bpi-iot-ros-ai systemd[1]: Started dnsmasq - A lightweight DHCP 
and caching DNS server.
-- Subject: Unit dnsmasq.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit dnsmasq.service has finished starting up.
--
-- The start-up result is done.
Nov 23 21:23:53 bpi-iot-ros-ai systemd[1]: Reached target Host and Network Name 
Lookups.
-- Subject: Unit nss-lookup.target has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit nss-lookup.target has finished starting up.
--
-- The start-up result is done.

我做错了什么?请帮帮我,我很困惑。

systemctl status hostapd 的结果

● hostapd.service - LSB: Advanced IEEE 802.11 management daemon
   Loaded: loaded (/etc/init.d/hostapd; bad; vendor preset: enabled)
   Active: active (exited) since Fri 2018-11-23 21:33:17 CST; 2 days ago
     Docs: man:systemd-sysv-generator(8)
  Process: 924 ExecStart=/etc/init.d/hostapd start (code=exited, status=0/SUCCESS)

Nov 23 21:33:16 bpi-iot-ros-ai systemd[1]: Starting LSB: Advanced IEEE 802.11 management daemon...
Nov 23 21:33:17 bpi-iot-ros-ai hostapd[924]:  * Starting advanced IEEE 802.11 management hostapd
Nov 23 21:33:17 bpi-iot-ros-ai hostapd[924]:    ...fail!
Nov 23 21:33:17 bpi-iot-ros-ai systemd[1]: Started LSB: Advanced IEEE 802.11 management daemon.
Nov 26 12:28:45 bpi-iot-ros-ai systemd[1]: Started LSB: Advanced IEEE 802.11 management daemon.

输出sudo hostapd -d /etc/hostapd/hostapd.conf

random: Trying to read entropy from /dev/random
Configuration file: /etc/hostapd/hostapd.conf
ctrl_interface_group=0
nl80211: Could not add multicast membership for vendor events: -2 (No such file or                                                                                       directory)
rfkill: initial event: idx=0 type=2 op=0 soft=0 hard=0
rfkill: initial event: idx=1 type=1 op=0 soft=0 hard=0
rfkill: initial event: idx=2 type=1 op=0 soft=0 hard=0
rfkill: initial event: idx=3 type=1 op=0 soft=0 hard=0
rfkill: initial event: idx=4 type=1 op=0 soft=0 hard=0
rfkill: initial event: idx=5 type=2 op=0 soft=0 hard=0
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:6
nl80211: Using driver-based off-channel TX
nl80211: TDLS supported
nl80211: Use separate P2P group interface (driver advertised support)
nl80211: Enable multi-channel concurrent (driver advertised support)
nl80211: Disable use_monitor with device_ap_sme since no monitor mode support detected
nl80211: interface wlan0 in phy phy2
nl80211: Set mode ifindex 8 iftype 3 (AP)
nl80211: Setup AP(wlan0) - device_ap_sme=1 use_monitor=0
nl80211: Subscribe to mgmt frames with AP handle 0xb6f64d08 (device SME)
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) 
nl_handle=0xb6f64d08 match=
nl80211: Register frame command failed (type=208): ret=-114 (Operation already in progress)
nl80211: Register frame match - hexdump(len=0): [NULL]
nl80211: Could not configure driver mode
nl80211: deinit ifname=wlan0 disabled_11b_rates=0
nl80211: Remove monitor interface: refcount=0
nl80211: Remove beacon (ifindex=8)
netlink: Operstate: ifindex=8 linkmode=0 (kernel-control), operstate=6 (IF_OPER_UP)
nl80211 driver initialization failed.
hostapd_interface_deinit_free(0xb6f61cd8)
hostapd_interface_deinit_free: num_bss=1 conf->num_bss=1
hostapd_interface_deinit(0xb6f61cd8)
wlan0: interface state UNINITIALIZED->DISABLED
hostapd_bss_deinit: deinit bss wlan0
wlan0: AP-DISABLED
hostapd_cleanup(hapd=0xb6f629a0 (wlan0))
hostapd_free_hapd_data: Interface wlan0 wasn't started
hostapd_interface_deinit_free: driver=(nil) drv_priv=(nil) -> hapd_deinit
hostapd_interface_free(0xb6f61cd8)
hostapd_interface_free: free hapd 0xb6f629a0
hostapd_cleanup_iface(0xb6f61cd8)
hostapd_cleanup_iface_partial(0xb6f61cd8)
hostapd_cleanup_iface: free iface=0xb6f61cd8

答案1

从我看到的情况来看,你真的设置路由器。

这似乎也是几组不同指令的混合体。我发现有两个基本问题。第一个是 hostapd 的启动方式。

auto lo
    iface lo inet loopback

auto eth0
    iface eth0 inet static
    address 192.168.55.227
    netmask 255.255.255.0
    network 192.168.55.0
    broadcast 192.168.55.255
    gateway 192.168.55.1
    dns-nameservers 192.168.55.1

auto wlan0
    iface wlan0 inet static
    address 172.24.1.1
    netmask 24

allow-hotplug wlan1
    iface wlan1 inet dhcp
    wpa-ssid "hotspot"
    wpa-psk "passkey123

或多或少 - 从网络中删除启动 hostapd。

然后你应该运行sudo systemctl start hostapd- 看看它是否出现,并sudo systemctl enable hostapd确保它始终启动。你的 hostapd 配置文件是 小的很挑剔。我通过使用 复制默认值从头开始编写了我的代码$ zcat /usr/share/doc/hostapd/examples/hostapd.conf.gz | sudo tee /etc/hostapd/hostapd.conf > /dev/null

应该此时能够连接到您的 AP - 尽管您需要在内核和防火墙上设置数据包转发等,这是一个完全不同的问题。

相关内容