Ubuntu 18.04 上 Wi-Fi 随机断开

Ubuntu 18.04 上 Wi-Fi 随机断开

我的 ThinkPad-L440 上的 Wi-Fi 在 Ubuntu 18.04 上随机断开。我已经做了很多故障排除并尝试了很多建议的解决方案,但问题仍然存在。

有时,在浏览互联网时,我会注意到持续保持连接的网站(例如 Reddit、Google Drive)说我离线了几秒钟,然后又恢复正常。此外,一些即时通讯工具也会在同一时间窗口下线。我创建了一个小脚本来 ping 我的路由器 IP、打印时间并在 ping 失败时发出蜂鸣声。事实上,我经常检测到短暂的 Wi-Fi 重新连接(大多数时间间隔为 60-90 秒)。

到目前为止我发现了什么:

  • 确认问题出在客户端,不是硬件问题(查看路由器日志,其他设备没有这样的问题,甚至同样的笔记本电脑在 Windows 中启动工作正常
  • 删除已保存的连接并重新连接(nmcli con delete <SSID>nmcli dev wifi connect <SSID> password <password>)以及各种重新启动服务、重新启动设备等。
  • 强制客户端和路由器端连接到 2.4 GHz 和 5 GHz 频段(我的 AP 是具有相同 SSID 的双频段) - 在 2.4 中似乎较少发生,但仍未完全消除。使用 2.4 Ghz 对我来说不是一个解决方案,因为我还需要 5 GHz。
  • 禁用省电功能/etc/NetworkManager/conf.d/default-wifi-powersave-on.conf
  • 注释掉dhcp6.name-servers, dhcp6.domain-search, dhcp6.fqdn, dhcp6.sntp-servers,行中/etc/dhcp/dhclient.conf
  • 完全禁用无线接口的 IPv6
  • 检查DNS配置:
/etc/resolv.conf -> /run/systemd/resolve/stub-resolv.conf:
# This file is managed by man:systemd-resolved(8). Do not edit.
...
nameserver 127.0.0.53
options edns0
search lan
----------------
/etc/systemd/resolved.conf:
#  This file is part of systemd.
[Resolve]
#DNS=
#FallbackDNS=
#Domains=
#LLMNR=no
#MulticastDNS=no
#DNSSEC=no
#Cache=yes
#DNSStubListener=yes
  • 检查网络管理器配置:
/etc/NetworkManager/NetworkManager.conf:
[main]
plugins=ifupdown,keyfile

[ifupdown]
managed=false

[device]
wifi.scan-rand-mac-address=no
----------------
/etc/NetworkManager/conf.d/default-wifi-powersave-on.conf:
[connection]
wifi.powersave = 2
dmesg:
[ 3205.127410] wlp2s0: Limiting TX power to 17 (20 - 3) dBm as advertised by XX:XX:XX:XX:XX:XX
[ 3284.204536] wlp2s0: deauthenticating from XX:XX:XX:XX:XX:XX by local choice (Reason: 3=DEAUTH_LEAVING)
[ 3286.955049] wlp2s0: authenticate with XX:XX:XX:XX:XX:XX
[ 3286.958967] wlp2s0: send auth to XX:XX:XX:XX:XX:XX (try 1/3)
[ 3286.961583] wlp2s0: authenticated
[ 3286.964357] wlp2s0: associate with XX:XX:XX:XX:XX:XX (try 1/3)
[ 3286.966033] wlp2s0: RX AssocResp from XX:XX:XX:XX:XX:XX (capab=0x111 status=0 aid=2)
[ 3286.967569] wlp2s0: associated
----------------
Network-Manager.service:
Nov 26 10:27:31 ThinkPad-L440 NetworkManager[954]: <debug> [1701012451.6742] platform: signal: link changed: 3: wlp2s0 <UP;broadcast,multicast,up> mtu 1500 arp 1 wifi? init addrgenmode none addr XX:XX:XX:XX:XX:XX driver iwlwifi rx:23080,12307791 tx:21126,3434093
Nov 26 10:27:31 ThinkPad-L440 NetworkManager[954]: <debug> [1701012451.6743] device[0x55a4db33bb30] (wlp2s0): queued link change for ifindex 3
Nov 26 10:27:31 ThinkPad-L440 NetworkManager[954]: <warn>  [1701012451.6746] sup-iface[0x55a4db3be030,wlp2s0]: connection disconnected (reason -3)
...
Nov 26 10:31:57 ThinkPad-L440 NetworkManager[954]: <debug> [1701012717.2698] auth: call[254]: CheckAuthorization succeeded: (is_authorized=1, is_challenge=0)
Nov 26 10:31:57 ThinkPad-L440 NetworkManager[954]: <debug> [1701012717.2698] device[0x55a4db33bb30] (wlp2s0): wifi-scan: scanning requested
Nov 26 10:31:57 ThinkPad-L440 NetworkManager[954]: <debug> [1701012717.2699] device[0x55a4db33bb30] (wlp2s0): wifi-scan: no SSIDs to probe scan
Nov 26 10:31:57 ThinkPad-L440 NetworkManager[954]: <debug> [1701012717.2700] device[0x55a4db33bb30] (wlp2s0): add_pending_action (1): 'wifi-scan'
Nov 26 10:31:57 ThinkPad-L440 NetworkManager[954]: <debug> [1701012717.2700] device[0x55a4db33bb30] (wlp2s0): wifi-scan: scheduled in 120 seconds (interval now 120 seconds)
Nov 26 10:31:57 ThinkPad-L440 NetworkManager[954]: <debug> [1701012717.2761] device[0x55a4db33bb30] (wlp2s0): wifi-scan: scanning-state: scanning
Nov 26 10:32:01 ThinkPad-L440 NetworkManager[954]: <debug> [1701012721.0916] device[0x55a4db33bb30] (wlp2s0): wifi-scan: scanning-state: idle
Nov 26 10:32:01 ThinkPad-L440 NetworkManager[954]: <debug> [1701012721.1181] device[0x55a4db33bb30] (wlp2s0): failed to match hidden AP XX:XX:XX:XX:XX:XX
Nov 26 10:32:01 ThinkPad-L440 NetworkManager[954]: <debug> [1701012721.1427] device[0x55a4db33bb30] (wlp2s0): wifi-scan: scan-done callback: successful
Nov 26 10:32:01 ThinkPad-L440 NetworkManager[954]: <debug> [1701012721.1428] device[0x55a4db33bb30] (wlp2s0): remove_pending_action (0): 'wifi-scan'
Nov 26 10:32:15 ThinkPad-L440 NetworkManager[954]: <debug> [1701012735.2661] auth: call[255]: CheckAuthorization(org.freedesktop.NetworkManager.network-control), subject=unix-process[pid=6045, uid=1000, start=300653]
Nov 26 10:32:15 ThinkPad-L440 NetworkManager[954]: <debug> [1701012735.2681] auth: call[255]: CheckAuthorization succeeded: (is_authorized=1, is_challenge=0)
Nov 26 10:32:15 ThinkPad-L440 NetworkManager[954]: <debug> [1701012735.2682] device[0x55a4db33bb30] (wlp2s0): wifi-scan: scanning requested
Nov 26 10:32:15 ThinkPad-L440 NetworkManager[954]: <debug> [1701012735.2683] device[0x55a4db33bb30] (wlp2s0): wifi-scan: no SSIDs to probe scan
Nov 26 10:32:15 ThinkPad-L440 NetworkManager[954]: <debug> [1701012735.2684] device[0x55a4db33bb30] (wlp2s0): add_pending_action (1): 'wifi-scan'
Nov 26 10:32:15 ThinkPad-L440 NetworkManager[954]: <debug> [1701012735.2684] device[0x55a4db33bb30] (wlp2s0): wifi-scan: scheduled in 120 seconds (interval now 120 seconds)
Nov 26 10:32:15 ThinkPad-L440 NetworkManager[954]: <debug> [1701012735.2748] device[0x55a4db33bb30] (wlp2s0): wifi-scan: scanning-state: scanning
Nov 26 10:32:19 ThinkPad-L440 NetworkManager[954]: <debug> [1701012739.3076] device[0x55a4db33bb30] (wlp2s0): wifi-scan: scanning-state: idle
Nov 26 10:32:19 ThinkPad-L440 NetworkManager[954]: <debug> [1701012739.3508] device[0x55a4db33bb30] (wlp2s0): wifi-scan: scan-done callback: successful
Nov 26 10:32:19 ThinkPad-L440 NetworkManager[954]: <debug> [1701012739.3508] device[0x55a4db33bb30] (wlp2s0): remove_pending_action (0): 'wifi-scan'
Nov 26 10:32:19 ThinkPad-L440 NetworkManager[954]: <debug> [1701012739.3798] ndisc-lndp[0x55a4db399f80,"wlp2s0"]: processing libndp events
  • 检查wpa_supplicant.service日志和状态以确保没有多个 dhcp 客户端干扰网络管理器。wpa_supplicant作为由网络管理器通过 d-bus 启动的守护进程运行。一切看起来都很好,日志中没有警告或错误。

用于调试的一些附加信息:

$ sudo lshw -C network
        description: Wireless interface
        product: Wireless 7260
        vendor: Intel Corporation
        physical id: 0
        bus info: pci@0000:02:00.0
        logical name: wlp2s0
        version: 83
        serial: XX:XX:XX:XX:XX:XX
        width: 64 bits
        clock: 33MHz
        capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
        configuration: broadcast=yes driver=iwlwifi driverversion=4.15.0-213-generic firmware=17.948900127.0 ip=192.168.2.248 latency=0 link=yes multicast=yes wireless=IEEE 802.11
        resources: irq:32 memory:f2400000-f2401fff

$ sudo iwconfig
wlp2s0    IEEE 802.11  ESSID:"XXXXXXXXXX"  
          Mode:Managed  Frequency:5.66 GHz  Access Point: XX:XX:XX:XX:XX:XX   
          Bit Rate=866.7 Mb/s   Tx-Power=17 dBm   
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off
          Link Quality=54/70  Signal level=-56 dBm  
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:8   Missed beacon:0

$ sudo nmcli connection show
connection.id:                          XXXXXXXXXX
connection.uuid:                        31ce91dc-831d-4343-a876-1fd0570bddd4
connection.stable-id:                   --
connection.type:                        802-11-wireless
connection.interface-name:              --
connection.autoconnect:                 yes
connection.autoconnect-priority:        0
connection.autoconnect-retries:         -1 (default)
connection.auth-retries:                -1
connection.timestamp:                   1701017466
connection.read-only:                   no
connection.permissions:                 --
connection.zone:                        --
connection.master:                      --
connection.slave-type:                  --
connection.autoconnect-slaves:          -1 (default)
connection.secondaries:                 --
connection.gateway-ping-timeout:        0
connection.metered:                     unknown
connection.lldp:                        default
connection.mdns:                        -1 (default)
802-11-wireless.ssid:                   XXXXXXXXXX
802-11-wireless.mode:                   infrastructure
802-11-wireless.band:                   --
802-11-wireless.channel:                0
802-11-wireless.bssid:                  --
802-11-wireless.rate:                   0
802-11-wireless.tx-power:               0
802-11-wireless.mac-address:            XX:XX:XX:XX:XX:XX
802-11-wireless.cloned-mac-address:     --
802-11-wireless.generate-mac-address-mask:--
802-11-wireless.mac-address-blacklist:  --
802-11-wireless.mac-address-randomization:default
802-11-wireless.mtu:                    auto
802-11-wireless.seen-bssids:            XX:XX:XX:XX:XX:XX,XX:XX:XX:XX:XX:XX
802-11-wireless.hidden:                 no
802-11-wireless.powersave:              0 (default)
802-11-wireless-security.key-mgmt:      wpa-psk
802-11-wireless-security.wep-tx-keyidx: 0
802-11-wireless-security.auth-alg:      --
802-11-wireless-security.proto:         --
802-11-wireless-security.pairwise:      --
802-11-wireless-security.group:         --
802-11-wireless-security.pmf:           0 (default)
802-11-wireless-security.leap-username: --
802-11-wireless-security.wep-key0:      <hidden>
802-11-wireless-security.wep-key1:      <hidden>
802-11-wireless-security.wep-key2:      <hidden>
802-11-wireless-security.wep-key3:      <hidden>
802-11-wireless-security.wep-key-flags: 0 (none)
802-11-wireless-security.wep-key-type:  unknown
802-11-wireless-security.psk:           <hidden>
802-11-wireless-security.psk-flags:     0 (none)
802-11-wireless-security.leap-password: <hidden>
802-11-wireless-security.leap-password-flags:0 (none)
802-11-wireless-security.wps-method:    0 (default)
ipv4.method:                            auto
ipv4.dns:                               --
ipv4.dns-search:                        --
ipv4.dns-options:                       ""
ipv4.dns-priority:                      0
ipv4.addresses:                         --
ipv4.gateway:                           --
ipv4.routes:                            --
ipv4.route-metric:                      -1
ipv4.route-table:                       0 (unspec)
ipv4.ignore-auto-routes:                no
ipv4.ignore-auto-dns:                   no
ipv4.dhcp-client-id:                    --
ipv4.dhcp-timeout:                      0 (default)
ipv4.dhcp-send-hostname:                yes
ipv4.dhcp-hostname:                     --
ipv4.dhcp-fqdn:                         --
ipv4.never-default:                     no
ipv4.may-fail:                          yes
ipv4.dad-timeout:                       -1 (default)
ipv6.method:                            auto
ipv6.dns:                               --
ipv6.dns-search:                        --
ipv6.dns-options:                       ""
ipv6.dns-priority:                      0
ipv6.addresses:                         --
ipv6.gateway:                           --
ipv6.routes:                            --
ipv6.route-metric:                      -1
ipv6.route-table:                       0 (unspec)
ipv6.ignore-auto-routes:                no
ipv6.ignore-auto-dns:                   no
ipv6.never-default:                     no
ipv6.may-fail:                          yes
ipv6.ip6-privacy:                       0 (disabled)
ipv6.addr-gen-mode:                     stable-privacy
ipv6.dhcp-send-hostname:                yes
ipv6.dhcp-hostname:                     --
ipv6.token:                             --
proxy.method:                           none
proxy.browser-only:                     no
proxy.pac-url:                          --
proxy.pac-script:                       --
GENERAL.NAME:                           XXXXXXXXXX
GENERAL.UUID:                           31ce91dc-831d-4343-a876-1fd0570bddd4
GENERAL.DEVICES:                        wlp2s0
GENERAL.STATE:                          activated
GENERAL.DEFAULT:                        yes
GENERAL.DEFAULT6:                       yes
GENERAL.SPEC-OBJECT:                    /org/freedesktop/NetworkManager/AccessPoint/2
GENERAL.VPN:                            no
GENERAL.DBUS-PATH:                      /org/freedesktop/NetworkManager/ActiveConnection/3
GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/Settings/6
GENERAL.ZONE:                           --
GENERAL.MASTER-PATH:                    --
IP4.ADDRESS[1]:                         192.168.2.248/24
IP4.GATEWAY:                            192.168.2.1
IP4.ROUTE[1]:                           dst = 192.168.2.0/24, nh = 0.0.0.0, mt = 600
IP4.ROUTE[2]:                           dst = 0.0.0.0/0, nh = 192.168.2.1, mt = 600
IP4.DNS[1]:                             192.168.2.1
IP4.DOMAIN[1]:                          lan
DHCP4.OPTION[1]:                        domain_name = lan
DHCP4.OPTION[2]:                        requested_routers = 1
DHCP4.OPTION[3]:                        requested_netbios_scope = 1
DHCP4.OPTION[4]:                        requested_subnet_mask = 1
DHCP4.OPTION[5]:                        dhcp_server_identifier = 192.168.2.1
DHCP4.OPTION[6]:                        requested_domain_search = 1
DHCP4.OPTION[7]:                        requested_host_name = 1
DHCP4.OPTION[8]:                        subnet_mask = 255.255.255.0
DHCP4.OPTION[9]:                        requested_ntp_servers = 1
DHCP4.OPTION[10]:                       next_server = 192.168.2.1
DHCP4.OPTION[11]:                       network_number = 192.168.2.0
DHCP4.OPTION[12]:                       dhcp_lease_time = 43200
DHCP4.OPTION[13]:                       dhcp_message_type = 5
DHCP4.OPTION[14]:                       requested_domain_name_servers = 1
DHCP4.OPTION[15]:                       requested_netbios_name_servers = 1
DHCP4.OPTION[16]:                       expiry = 1701060666
DHCP4.OPTION[17]:                       requested_time_offset = 1
DHCP4.OPTION[18]:                       requested_broadcast_address = 1
DHCP4.OPTION[19]:                       ip_address = 192.168.2.248
DHCP4.OPTION[20]:                       domain_name_servers = 192.168.2.1
DHCP4.OPTION[21]:                       broadcast_address = 192.168.2.255
DHCP4.OPTION[22]:                       requested_domain_name = 1
DHCP4.OPTION[23]:                       requested_ms_classless_static_routes = 1
DHCP4.OPTION[24]:                       dhcp_rebinding_time = 37800
DHCP4.OPTION[25]:                       requested_static_routes = 1
DHCP4.OPTION[26]:                       host_name = ThinkPad-L440
DHCP4.OPTION[27]:                       dhcp_renewal_time = 21600
DHCP4.OPTION[28]:                       requested_wpad = 1
DHCP4.OPTION[29]:                       requested_interface_mtu = 1
DHCP4.OPTION[30]:                       requested_rfc3442_classless_static_routes = 1
DHCP4.OPTION[31]:                       routers = 192.168.2.1
IP6.ADDRESS[1]:                         2606:6d00:17:1796:b8a6:2ecd:8a68:6eab/64
IP6.ADDRESS[2]:                         fd03:bb95:6ff8:0:88e5:422f:3bbe:7a9f/64
IP6.ADDRESS[3]:                         2606:6d00:17:1796::1c0/128
IP6.ADDRESS[4]:                         fd03:bb95:6ff8::1c0/128
IP6.ADDRESS[5]:                         fe80::75e0:860c:9167:4558/64
IP6.GATEWAY:                            fe80::52d2:f5ff:fe09:3b20
IP6.ROUTE[1]:                           dst = ff00::/8, nh = ::, mt = 256, table=255
IP6.ROUTE[2]:                           dst = fe80::/64, nh = ::, mt = 256
IP6.ROUTE[3]:                           dst = fe80::/64, nh = ::, mt = 600
IP6.ROUTE[4]:                           dst = 2606:6d00:17:1796::1c0/128, nh = ::, mt = 600
IP6.ROUTE[5]:                           dst = fd03:bb95:6ff8::1c0/128, nh = ::, mt = 600
IP6.ROUTE[6]:                           dst = fd03:bb95:6ff8::/48, nh = fe80::52d2:f5ff:fe09:3b20, mt = 600
IP6.ROUTE[7]:                           dst = fd03:bb95:6ff8::/64, nh = ::, mt = 600
IP6.ROUTE[8]:                           dst = 2606:6d00:17:1796::/64, nh = ::, mt = 600
IP6.ROUTE[9]:                           dst = ::/0, nh = fe80::52d2:f5ff:fe09:3b20, mt = 600
IP6.DNS[1]:                             fd03:bb95:6ff8::1
DHCP6.OPTION[1]:                        dhcp6_name_servers = fd03:bb95:6ff8::1
DHCP6.OPTION[2]:                        ip6_address = 2606:6d00:17:1796::1c0
DHCP6.OPTION[3]:                        dhcp6_client_id = 0:4:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:98:ac:fa:f3
DHCP6.OPTION[4]:                        life_starts = 1701008951
DHCP6.OPTION[5]:                        rebind = 34560
DHCP6.OPTION[6]:                        starts = 1701008951
DHCP6.OPTION[7]:                        dhcp6_server_id = 0:3:0:1:50:d2:f5:9:3b:20
DHCP6.OPTION[8]:                        dhcp6_solmax_rt = 60
DHCP6.OPTION[9]:                        requested_dhcp6_client_id = 1
DHCP6.OPTION[10]:                       requested_dhcp6_name_servers = 1
DHCP6.OPTION[11]:                       max_life = 43200
DHCP6.OPTION[12]:                       requested_dhcp6_domain_search = 1
DHCP6.OPTION[13]:                       ip6_prefixlen = 64
DHCP6.OPTION[14]:                       renew = 21600
DHCP6.OPTION[15]:                       iaid = 4f:9e:d3:6f
DHCP6.OPTION[16]:                       preferred_life = 43200

$ sudo modinfo iwlwifi- 输出开启帕斯特宾

我现在已经没有想法了。我已经检查并尝试了我想到的所有内容以及我在谷歌上可以找到的内容。我看到的唯一选择 - 这是 Linux 内核和/或无线驱动程序中的某种错误。但在得到确认之前我不想搞乱这件事。

请帮我解决问题。

相关内容