Ubuntu 19.04,Z83,BRCM 43455,加密重新密钥后 Wifi 变得不稳定

Ubuntu 19.04,Z83,BRCM 43455,加密重新密钥后 Wifi 变得不稳定

我在一台小型 Z83 PC 上运行 ubuntu,该 PC 带有嵌入式 wifi 适配器。搬家后,我现在通过 wifi 而不是以太网使用它(它控制一台自动钢琴)。

我发现它不可靠。我不知道这是否是一个新问题,因为我最近也设置了网络监控,所以我才注意到它。当“失败”时,设备运行但看起来很慢,所以我过去可能忽略了它。

几个小时内它完全稳定,然后就变得不稳定了——数据包丢失和 ping 时间长。这种转变总是在 wifi 重新密钥后立即发生。重新密钥成功,wifi 保持关联,只是之后工作不正常。

设备在 2.4ghz 上关联,路由器显示信号为 -52,噪声为 -80 dbm,即非常好的信号(实际上距离路由器约 20 英尺)。设备(google mini、LG TV)在距离路由器几倍远的地方运行良好。

平

上面大约是 24 小时,中间的部分非常好,两端的部分很糟糕,勉强能用。

我已经从 17.10 升级到 19.10(我认为是),然后更新了它。我关闭了 wifi 上的电源管理。我关闭了 IPv6(一些帖子指出这是一个问题,在最近的案例中它又重新启用了)。netstat -i 显示丢弃了接收的数据包,但 tx/rx 上没有错误,tx 上也没有错误。

netplan apply 无法修复此问题。重启总是可以修复此问题,但几个小时后才会修复,每次出现问题时都会重新密钥(至少 +/- 1 分钟,这是我记录 ping 结果的频率)。

该路由器是运行 OpenWRT 18.06 的相当新的 Linksys AC1900ACS;其他设备没有问题。

不幸的是,我将粘贴上次重新密钥的所有日志。它有点长,但不确定其中的内容会给某人提供线索。我看到了四个重新密钥语句,我有四个 VLAN,所以让我提一下——这是在通用 VLAN 上,所有地址都正确显示。其他 VLAN 用于视频、访客、自动化等。我不认为那里有问题,但我也不知道为什么会有四条重新密钥消息,但总是有。每个 VLAN 都有不同的 SSID,这显然是通过该 SSID 关联的,而且只有一个 SSID。

以下是上次事件的日志。我很感激任何建议,除了(我想这是我的下一步)在墙上拉一根线到路由器。

Sep  4 19:13:30 notes wpa_supplicant[878]: wlan0: WPA: Group rekeying completed with 26:f5:a2:bf:1f:0c [GTK=CCMP]
Sep  4 19:13:33 notes wpa_supplicant[878]: message repeated 3 times: [ wlan0: WPA: Group rekeying completed with 26:f5:a2:bf:1f:0c [GTK=CCMP]]
Sep  4 19:13:46 notes systemd-networkd[610]: wlan0: Lost carrier
Sep  4 19:13:46 notes avahi-daemon[716]: Withdrawing address record for 192.168.130.172 on wlan0.
Sep  4 19:13:46 notes wpa_supplicant[878]: wlan0: CTRL-EVENT-DISCONNECTED bssid=26:f5:a2:bf:1f:0c reason=7 locally_generated=1
Sep  4 19:13:46 notes wpa_supplicant[878]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=CORE type=WORLD
Sep  4 19:13:46 notes systemd-networkd[610]: wlan0: DHCP lease lost
Sep  4 19:13:46 notes avahi-daemon[716]: Leaving mDNS multicast group on interface wlan0.IPv4 with address 192.168.130.172.
Sep  4 19:13:46 notes systemd-networkd[610]: wlan0: DHCPv6 lease lost
Sep  4 19:13:46 notes dbus-daemon[725]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service' requested by ':1.1' (uid=101 pid=610 comm="/lib/systemd/systemd-networkd " label="unconfined")
Sep  4 19:13:46 notes systemd-timesyncd[605]: No network connectivity, watching for changes.
Sep  4 19:13:46 notes avahi-daemon[716]: Interface wlan0.IPv4 no longer relevant for mDNS.
Sep  4 19:13:46 notes avahi-daemon[716]: Withdrawing address record for fdf5:7fae:c03f::a51 on wlan0.
Sep  4 19:13:46 notes avahi-daemon[716]: Withdrawing address record for XXXX:XXX:XXXX:XXXX::a51 on wlan0.
Sep  4 19:13:46 notes avahi-daemon[716]: Withdrawing address record for fdf5:7fae:c03f:0:ce4b:73ff:fe43:5b0 on wlan0.
Sep  4 19:13:46 notes avahi-daemon[716]: Withdrawing address record for XXXX:XXX:XXXX:XXXX:ce4b:73ff:fe43:5b0 on wlan0.
Sep  4 19:13:46 notes avahi-daemon[716]: Leaving mDNS multicast group on interface wlan0.IPv6 with address XXXX:XXX:XXXX:XXXX:ce4b:73ff:fe43:5b0.
Sep  4 19:13:46 notes avahi-daemon[716]: Joining mDNS multicast group on interface wlan0.IPv6 with address fe80::ce4b:73ff:fe43:5b0.
Sep  4 19:13:46 notes avahi-daemon[716]: Registering new address record for fe80::ce4b:73ff:fe43:5b0 on wlan0.*.
Sep  4 19:13:46 notes systemd[1]: Starting Hostname Service...
Sep  4 19:13:48 notes wpa_supplicant[878]: wlan0: Trying to associate with SSID 'MYSSID'
Sep  4 19:13:51 notes systemd-networkd[610]: wlan0: Gained carrier
Sep  4 19:13:51 notes systemd-timesyncd[605]: Network configuration changed, trying to establish connection.
Sep  4 19:13:51 notes wpa_supplicant[878]: wlan0: Associated with 26:f5:a2:bf:1f:0d
Sep  4 19:13:51 notes wpa_supplicant[878]: wlan0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
Sep  4 19:13:51 notes wpa_supplicant[878]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=COUNTRY_IE type=COUNTRY alpha2=US
Sep  4 19:13:51 notes systemd-networkd[610]: wlan0: Lost carrier
Sep  4 19:13:51 notes wpa_supplicant[878]: wlan0: WPA: Key negotiation completed with 26:f5:a2:bf:1f:0d [PTK=CCMP GTK=CCMP]
Sep  4 19:13:51 notes wpa_supplicant[878]: wlan0: CTRL-EVENT-CONNECTED - Connection to 26:f5:a2:bf:1f:0d completed [id=0 id_str=]
Sep  4 19:13:51 notes systemd-networkd[610]: wlan0: Gained carrier
Sep  4 19:13:51 notes systemd-timesyncd[605]: Network configuration changed, trying to establish connection.
Sep  4 19:13:52 notes avahi-daemon[716]: Leaving mDNS multicast group on interface wlan0.IPv6 with address fe80::ce4b:73ff:fe43:5b0.
Sep  4 19:13:52 notes avahi-daemon[716]: Joining mDNS multicast group on interface wlan0.IPv6 with address XXXX:XXX:XXXX:XXXX:ce4b:73ff:fe43:5b0.
Sep  4 19:13:52 notes systemd-timesyncd[605]: Network configuration changed, trying to establish connection.
Sep  4 19:13:52 notes avahi-daemon[716]: Registering new address record for XXXX:XXX:XXXX:XXXX:ce4b:73ff:fe43:5b0 on wlan0.*.
Sep  4 19:13:52 notes avahi-daemon[716]: Withdrawing address record for fe80::ce4b:73ff:fe43:5b0 on wlan0.
Sep  4 19:13:52 notes avahi-daemon[716]: Registering new address record for fdf5:7fae:c03f:0:ce4b:73ff:fe43:5b0 on wlan0.*.
Sep  4 19:13:52 notes whoopsie[982]: [19:13:52] Cannot reach: https://daisy.ubuntu.com
Sep  4 19:13:52 notes whoopsie[982]: [19:13:52] Cannot reach: https://daisy.ubuntu.com
Sep  4 19:13:53 notes systemd-networkd[610]: wlan0: DHCPv6 address fdf5:7fae:c03f::a51/128 timeout preferred -1 valid -1
Sep  4 19:13:53 notes systemd-networkd[610]: wlan0: DHCPv6 address XXXX:XXX:XXXX:XXXX::a51/128 timeout preferred 261560 valid 261560
Sep  4 19:13:53 notes avahi-daemon[716]: Registering new address record for fdf5:7fae:c03f::a51 on wlan0.*.
Sep  4 19:13:53 notes avahi-daemon[716]: Registering new address record for XXXX:XXX:XXXX:XXXX::a51 on wlan0.*.
Sep  4 19:13:53 notes systemd-timesyncd[605]: Network configuration changed, trying to establish connection.
Sep  4 19:13:53 notes whoopsie[982]: [19:13:53] Cannot reach: https://daisy.ubuntu.com
Sep  4 19:13:53 notes whoopsie[982]: [19:13:53] Cannot reach: https://daisy.ubuntu.com
Sep  4 19:13:53 notes systemd-timesyncd[605]: Synchronized to time server [2001:67c:1560:8003::c7]:123 (ntp.ubuntu.com).
Sep  4 19:13:54 notes systemd-networkd[610]: wlan0: DHCPv4 address 192.168.130.172/24 via 192.168.130.1
Sep  4 19:13:54 notes avahi-daemon[716]: Joining mDNS multicast group on interface wlan0.IPv4 with address 192.168.130.172.
Sep  4 19:13:54 notes avahi-daemon[716]: New relevant interface wlan0.IPv4 for mDNS.
Sep  4 19:13:54 notes avahi-daemon[716]: Registering new address record for 192.168.130.172 on wlan0.IPv4.
Sep  4 19:13:54 notes whoopsie[982]: [19:13:54] Cannot reach: https://daisy.ubuntu.com
Sep  4 19:13:54 notes systemd-resolved[679]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature level UDP.
Sep  4 19:13:54 notes systemd-resolved[679]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature level UDP.
Sep  4 19:13:54 notes systemd-networkd[610]: wlan0: Configured
Sep  4 19:14:00 notes dbus-daemon[725]: [system] Successfully activated service 'org.freedesktop.hostname1'
Sep  4 19:14:00 notes systemd[1]: Started Hostname Service.
Sep  4 19:14:07 notes colord[938]: failed to get session [pid 2003]: No data available
Sep  4 19:14:30 notes systemd[1]: systemd-hostnamed.service: Succeeded.

该设备显示在此处:

  *-network
       description: Wireless interface
       physical id: 1
       logical name: wlan0
       serial: cc:4b:73:43:05:b0
       capabilities: ethernet physical wireless
       configuration: broadcast=yes driver=brcmfmac driverversion=7.45.18 firmware=01-6a2c8ad4 ip=192.168.130.172 multicast=yes wireless=IEEE 802.11

答案1

我有一个解决方案,尽管我犹豫着是否将其称为答案。

第一个问题是,不知何故,NetworkManager 和 networkd 都在争夺 wlan0(wifi)设备。我发现我收到错误,指出 wpa_supplicant 的运行文件已经存在。我相信当 NetworkManager 配置设备时,它可以工作,而当 networkd 时则不行。重新密钥似乎允许竞争条件,而 networkd 获胜。这在很大程度上是假设,但是我使用四个服务禁用了 NetworkManager如该答案所示

sudo systemctl stop NetworkManager.service
sudo systemctl disable NetworkManager.service
sudo systemctl stop NetworkManager-wait-online.service
sudo systemctl disable NetworkManager-wait-online.service
sudo systemctl stop NetworkManager-dispatcher.service
sudo systemctl disable NetworkManager-dispatcher.service
sudo systemctl stop network-manager.service
sudo systemctl disable network-manager.service

之后,它重新启动并立即失败(即变得缓慢且不可靠)。我之前尝试禁用电源管理(@Kristopher Ives 正在按计划进行)显然仅适用于 NetworkManager。以下是 ping 的示例:

Pinging noteswifi.leferguson.com [192.168.130.173] with 32 bytes of data:
Reply from 192.168.130.173: bytes=32 time=3ms TTL=64   # with iwconfig wlan0 power off
Reply from 192.168.130.173: bytes=32 time=1ms TTL=64
Reply from 192.168.130.173: bytes=32 time=3ms TTL=64
Reply from 192.168.130.173: bytes=32 time=3ms TTL=64
Reply from 192.168.130.173: bytes=32 time=3ms TTL=64
Reply from 192.168.130.173: bytes=32 time=3ms TTL=64    # iwconfig wlan0 power on
Reply from 192.168.130.173: bytes=32 time=97ms TTL=64
Reply from 192.168.130.173: bytes=32 time=91ms TTL=64
Reply from 192.168.130.173: bytes=32 time=509ms TTL=64
Reply from 192.168.130.173: bytes=32 time=118ms TTL=64
Reply from 192.168.130.173: bytes=32 time=137ms TTL=64
Reply from 192.168.130.173: bytes=32 time=873ms TTL=64
Reply from 192.168.130.173: bytes=32 time=3ms TTL=64
Reply from 192.168.130.173: bytes=32 time=631ms TTL=64
Reply from 192.168.130.173: bytes=32 time=415ms TTL=64
Reply from 192.168.130.173: bytes=32 time=433ms TTL=64
Reply from 192.168.130.173: bytes=32 time=247ms TTL=64
Reply from 192.168.130.173: bytes=32 time=294ms TTL=64   # iwconfig wlan0 power off
Reply from 192.168.130.173: bytes=32 time=3ms TTL=64
Reply from 192.168.130.173: bytes=32 time=3ms TTL=64
Reply from 192.168.130.173: bytes=32 time=5ms TTL=64
Reply from 192.168.130.173: bytes=32 time=3ms TTL=64
Reply from 192.168.130.173: bytes=32 time=4ms TTL=64

请注意,该设备由线路供电,而不是电池供电。

更改后,下次 ping 时,更改立即生效。我无法找到一个地方以直接的方式为 networkd 配置该功能。这个答案尽管没有被赞成,但似乎可以工作(我使用 udo systemctl edit --full rc-local 确认 rc.local 已配置为运行)

sudo nano /etc/rc.local    # then add the text below: 

    iwconfig wlan0 power off   
    exit 0

此时,完成上述操作后,它已经稳定运行 24 小时,并且还通过了重新密钥。我找不到任何文档来表明这种竞争是存在的 —— 也许这个经过多次升级的系统最终配置不佳。此外,截至撰写本文时,19.10 还很新(尽管我的问题早于它 —— 但那可能只是电源管理问题)。此 ubuntu 安装是桌面版,并且存在 gnome,这似乎带来了网络管理器开销。也许我应该使用它而不是联网,但我想从终端而不是 gui 配置整个系统。

因此,希望对内部原理有更深入了解的人能够给出反馈,说明这是如何发生的,特别是是否有比运行启动脚本更好的方法来永久关闭电源管理。

相关内容