我有一台安装了 Ubuntu 20.04 服务器的 Mac Mini(因此没有 GUI)。并且想将其用作 WiFi 接入点,无需 NAT/DHCP 服务器(因此,假设主 Mikrotik 路由器是 192.168.88.1,Mac Mini 和连接到它的所有无线客户端都将位于 192.168.88.* 网络中)。
安装hostapd
并br-utils
编辑/etc/network/interfaces
等。没有桥接器hostapd
工作,让我们的手机连接到 WiFi(当然还没有互联网)。但是当我添加bridge=br0
到时hostapd.conf
,手机无法连接到 WiFi 网络,提示“密码无效”。
我做错了什么?
配置如下
hostapd.conf
::
interface=wlp3s0b1
ssid=SomeSSID
wpa_passphrase=12345678
hw_mode=g
country_code=UA
channel=7
wpa=2
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP
auth_algs=1
bridge=br0
/etc/network/interfaces
:
auto lo
iface lo inet loopback
auto enp2s0f0
allow-hotplug enp2s0f0
iface enp2s0f0 inet dhcp
auto wlp3s0b1
allow-hotplug wlp3s0b1
iface wlp3s0b1 inet dhcp
auto br0
iface br0 inet dhcp
bridge_ports enp2s0f0 wlp3s0b1
系统日志中有一些可疑的记录,在hostapd
重启后打印出来:
Feb 24 14:53:55 infmedia systemd[1]: Starting Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator...
Feb 24 14:53:55 infmedia hostapd[1278]: Configuration file: /etc/hostapd/hostapd.conf
Feb 24 14:53:55 infmedia kernel: [ 610.311270] b43-phy0: Loading firmware version 666.2 (2011-02-23 01:15:07)
Feb 24 14:53:55 infmedia systemd-networkd[684]: wlp3s0b1: Link UP
Feb 24 14:53:55 infmedia systemd-networkd[684]: rtnl: received neighbor for link '6' we don't know about, ignoring.
Feb 24 14:53:55 infmedia kernel: [ 610.487176] br0: port 1(wlp3s0b1) entered blocking state
Feb 24 14:53:55 infmedia kernel: [ 610.487180] br0: port 1(wlp3s0b1) entered disabled state
Feb 24 14:53:55 infmedia kernel: [ 610.487268] device wlp3s0b1 entered promiscuous mode
Feb 24 14:53:55 infmedia hostapd[1278]: wlp3s0b1: interface state UNINITIALIZED->COUNTRY_UPDATE
Feb 24 14:53:55 infmedia hostapd[1278]: Using interface wlp3s0b1 with hwaddr 7c:xx:xx:xx:xx:f9 and ssid "SomeSSID"
Feb 24 14:53:55 infmedia networkd-dispatcher[708]: WARNING:Unknown index 6 seen, reloading interface list
Feb 24 14:53:55 infmedia NetworkManager[700]: <info> [1614178435.4982] manager: (br0): new Bridge device (/org/freedesktop/NetworkManager/Devices/6)
Feb 24 14:53:55 infmedia systemd-udevd[1259]: Using default interface naming scheme 'v245'.
Feb 24 14:53:55 infmedia systemd-udevd[1259]: ethtool: autonegotiation is unset or enabled, the speed and duplex are not writable.
Feb 24 14:53:55 infmedia systemd-udevd[1259]: br0: Could not generate persistent MAC: No data available
Feb 24 14:53:55 infmedia NetworkManager[700]: <info> [1614178435.5038] device (wlp3s0b1): released from master device br0
Feb 24 14:53:55 infmedia kernel: [ 610.523498] IPv6: ADDRCONF(NETDEV_CHANGE): wlp3s0b1: link becomes ready
Feb 24 14:53:55 infmedia systemd-networkd[684]: wlp3s0b1: Gained carrier
Feb 24 14:53:55 infmedia hostapd[1278]: wlp3s0b1: interface state COUNTRY_UPDATE->ENABLED
Feb 24 14:53:55 infmedia hostapd[1278]: wlp3s0b1: AP-ENABLED
Feb 24 14:53:55 infmedia systemd[1]: Started Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator.
Feb 24 14:53:57 infmedia systemd-networkd[684]: wlp3s0b1: Gained IPv6LL
答案1
Ubuntu 20.04 NetworkManager 中存在一个错误,如果与桥接一起使用,WPA/WPA2 会出现密码错误。
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/315