Wifi 反复断线,有时不重启电脑就无法重新连接

Wifi 反复断线,有时不重启电脑就无法重新连接

我知道这个问题已经被问过很多次了,也有很多“解决方案”。但很多解决方案对我来说都不起作用。编辑:解决方案不起作用,所以问题仍然存在。 我发布这篇文章是因为我发现了一些似乎已经发挥作用并且可能对其他人有用。

我不是 IT/计算机科学人员,因此请理解我可能不知道解决此问题的所有技术方法。

我的 wifi 在连接后不久就出现了“掉线”的问题。这个问题一直存在,但有时需要几分钟才会断开连接。当我ping ubuntu.com连接时ping: ubuntu.com: Temporary failure in name resolution ,如果我ping 8.8.8.8连接

PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
From 192.168.178.105 icmp_seq=1 Destination Host Unreachable

偶尔,WiFi 会在“工作”和“不工作”之间切换,我不明白为什么会出现这种情况(这段时间我没有做任何不同的事情)。这段时间我的 ping 看起来像这样:

PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=3 ttl=116 time=872 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=116 time=76.7 ms
From 192.168.178.105 icmp_seq=38 Destination Host Unreachable
From 192.168.178.105 icmp_seq=39 Destination Host Unreachable
From 192.168.178.105 icmp_seq=40 Destination Host Unreachable
From 192.168.178.105 icmp_seq=45 Destination Host Unreachable
64 bytes from 8.8.8.8: icmp_seq=5 ttl=116 time=48245 ms
64 bytes from 8.8.8.8: icmp_seq=6 ttl=116 time=47213 ms
64 bytes from 8.8.8.8: icmp_seq=7 ttl=116 time=46189 ms

大多数情况下,WiFi 根本无法连接。

wifi 并不是“明显”的问题,因为我在 20 多个不同的 wifi 和热点上遇到这个问题已经超过三个月了。在所有情况下,wifi 都适用于我的手机和其他电脑。此外,我有时可以连接(似乎是随机的),但只能持续几分钟。以太网工作正常,笔记本电脑可以通过 USB 连接到我的手机(这是访问 wifi,而不是数据连接)连接到互联网。

当 wifi 处于打开状态时,我无法从手机(termux 应用程序)ping 计算机,也无法从计算机 ping 手机。

结果...

sudo lshw -class network
  *-network                 
       description: Ethernet interface
       product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:02:00.0
       logical name: enp2s0
       version: 15
       serial: 3c:7c:3f:ea:00:4e
       capacity: 1Gbit/s
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress msix bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=5.19.0-44-generic firmware=rtl8168h-2_0.0.2 02/26/15 latency=0 link=no multicast=yes port=twisted pair
       resources: irq:33 ioport:e000(size=256) memory:fc904000-fc904fff memory:fc900000-fc903fff
  *-network
       description: Wireless interface
       product: RTL8822CE 802.11ac PCIe Wireless Network Adapter
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:03:00.0
       logical name: wlp3s0
       version: 00
       serial: 94:08:53:4c:47:d7
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
       configuration: broadcast=yes driver=rtw_8822ce driverversion=5.19.0-44-generic firmware=N/A ip=192.168.178.105 latency=0 link=yes multicast=yes wireless=IEEE 802.11
       resources: irq:80 ioport:d000(size=256) memory:fc800000-fc80ffff
sudo dmesg | grep -i firmware
[108304.658940] rtw_8822ce 0000:03:00.0: failed to get tx report from firmware
[109316.179007] rtw_8822ce 0000:03:00.0: failed to get tx report from firmware
ip a

当 wifi 工作时...

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp2s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
    link/ether 3c:7c:3f:ea:00:4e brd ff:ff:ff:ff:ff:ff
4: wlp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 94:08:53:4c:47:d7 brd ff:ff:ff:ff:ff:ff
    inet 192.168.178.105/24 brd 192.168.178.255 scope global dynamic noprefixroute wlp3s0
       valid_lft 85601sec preferred_lft 85601sec
    inet6 fe80::1b92:c535:444d:c49b/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
5: mpqemubr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 52:54:00:66:d1:a5 brd ff:ff:ff:ff:ff:ff
    inet 10.181.94.1/24 brd 10.181.94.255 scope global mpqemubr0
       valid_lft forever preferred_lft forever
    inet6 fe80::5054:ff:fe66:d1a5/64 scope link 
       valid_lft forever preferred_lft forever
6: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
    link/ether 02:42:16:7e:75:ab brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
       valid_lft forever preferred_lft forever
7: lxdbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 00:16:3e:cd:6f:d7 brd ff:ff:ff:ff:ff:ff
    inet 10.8.182.1/24 scope global lxdbr0
       valid_lft forever preferred_lft forever
    inet6 fd42:58a3:ec4:bc97::1/64 scope global 
       valid_lft forever preferred_lft forever
    inet6 fe80::216:3eff:fecd:6fd7/64 scope link 
       valid_lft forever preferred_lft forever
9: vethfbd66b7f@if8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master lxdbr0 state UP group default qlen 1000
    link/ether 16:bf:ba:4d:8c:a7 brd ff:ff:ff:ff:ff:ff link-netnsid 0
11: veth68bc0cf0@if10: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master lxdbr0 state UP group default qlen 1000
    link/ether e6:8b:d1:15:4f:d2 brd ff:ff:ff:ff:ff:ff link-netnsid 1
13: veth0f1e58de@if12: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master lxdbr0 state UP group default qlen 1000
    link/ether be:85:da:19:94:07 brd ff:ff:ff:ff:ff:ff link-netnsid 2
15: vethffbc257b@if14: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master lxdbr0 state UP group default qlen 1000
    link/ether fa:97:21:29:d8:10 brd ff:ff:ff:ff:ff:ff link-netnsid 3
17: vetheb2a82f9@if16: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master lxdbr0 state UP group default qlen 1000
    link/ether 16:26:66:99:c4:f8 brd ff:ff:ff:ff:ff:ff link-netnsid 4
18: tap-f70da783792: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master mpqemubr0 state UP group default qlen 1000
    link/ether 86:06:5d:c4:9e:78 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::8406:5dff:fec4:9e78/64 scope link 
       valid_lft forever preferred_lft forever

当 wifi 不工作时...

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp2s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
    link/ether 3c:7c:3f:ea:00:4e brd ff:ff:ff:ff:ff:ff
4: wlp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 94:08:53:4c:47:d7 brd ff:ff:ff:ff:ff:ff
    inet 192.168.178.105/24 brd 192.168.178.255 scope global dynamic noprefixroute wlp3s0
       valid_lft 85553sec preferred_lft 85553sec
    inet6 fe80::1b92:c535:444d:c49b/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
5: mpqemubr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 52:54:00:66:d1:a5 brd ff:ff:ff:ff:ff:ff
    inet 10.181.94.1/24 brd 10.181.94.255 scope global mpqemubr0
       valid_lft forever preferred_lft forever
    inet6 fe80::5054:ff:fe66:d1a5/64 scope link 
       valid_lft forever preferred_lft forever
6: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
    link/ether 02:42:16:7e:75:ab brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
       valid_lft forever preferred_lft forever
7: lxdbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 00:16:3e:cd:6f:d7 brd ff:ff:ff:ff:ff:ff
    inet 10.8.182.1/24 scope global lxdbr0
       valid_lft forever preferred_lft forever
    inet6 fd42:58a3:ec4:bc97::1/64 scope global 
       valid_lft forever preferred_lft forever
    inet6 fe80::216:3eff:fecd:6fd7/64 scope link 
       valid_lft forever preferred_lft forever
9: vethfbd66b7f@if8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master lxdbr0 state UP group default qlen 1000
    link/ether 16:bf:ba:4d:8c:a7 brd ff:ff:ff:ff:ff:ff link-netnsid 0
11: veth68bc0cf0@if10: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master lxdbr0 state UP group default qlen 1000
    link/ether e6:8b:d1:15:4f:d2 brd ff:ff:ff:ff:ff:ff link-netnsid 1
13: veth0f1e58de@if12: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master lxdbr0 state UP group default qlen 1000
    link/ether be:85:da:19:94:07 brd ff:ff:ff:ff:ff:ff link-netnsid 2
15: vethffbc257b@if14: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master lxdbr0 state UP group default qlen 1000
    link/ether fa:97:21:29:d8:10 brd ff:ff:ff:ff:ff:ff link-netnsid 3
17: vetheb2a82f9@if16: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master lxdbr0 state UP group default qlen 1000
    link/ether 16:26:66:99:c4:f8 brd ff:ff:ff:ff:ff:ff link-netnsid 4
18: tap-f70da783792: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master mpqemubr0 state UP group default qlen 1000
    link/ether 86:06:5d:c4:9e:78 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::8406:5dff:fec4:9e78/64 scope link 
       valid_lft forever preferred_lft forever```
cat /etc/netplan/01-network-manager-all.yaml
# Let NetworkManager manage all devices on this system
network:
  version: 2
  renderer: NetworkManager
cat /usr/share/doc/netplan/examples/wireless.yaml 
network:
  version: 2
  renderer: networkd
  wifis:
    wlp2s0b1:
      regulatory-domain: "GB"
      dhcp4: no
      dhcp6: no
      addresses: [192.168.0.21/24]
      nameservers:
        addresses: [192.168.0.1, 8.8.8.8]
      access-points:
        "network_ssid_name":
          password: "**********"
      routes:
        - to: default
          via: 192.168.0.1
nmcli dev status
DEVICE             TYPE      STATE                   CONNECTION          
wlp3s0             wifi      connected               TPLINK casadelsole2 
lxdbr0             bridge    connected (externally)  lxdbr0              
mpqemubr0          bridge    connected (externally)  mpqemubr0           
docker0            bridge    connected (externally)  docker0             
tap-f70da783792    tun       connected (externally)  tap-f70da783792     
54:71:DD:38:60:F6  bt        disconnected            --                  
enp2s0             ethernet  unavailable             --                  
veth0f1e58de       ethernet  unmanaged               --                  
veth68bc0cf0       ethernet  unmanaged               --                  
vetheb2a82f9       ethernet  unmanaged               --                  
vethfbd66b7f       ethernet  unmanaged               --                  
vethffbc257b       ethernet  unmanaged               --                  
lo                 loopback  unmanaged               --        

系统信息:

OS: Ubuntu Sway 22.10 x86_64 
Host: ASUSTeK COMPUTER INC. FA506IH 
Kernel: 5.19.0-44-generic 
Uptime: 1 day, 6 hours, 31 mins 
Packages: 4319 (dpkg), 63 (snap) 
Shell: bash 5.2.2 
WM: sway 
Terminal: kitty 
CPU: AMD Ryzen 7 4800H with Radeon Graphics (16) @ 2.900GHz 
GPU: NVIDIA NVIDIA Corporation TU117M 
GPU: AMD ATI Renoir 
Memory: 11834MiB / 39521MiB 

答案1

编辑:此“解决方案”并未解决问题。最后,我升级到 Ubuntu 23.04,这样 wifi 问题就解决了。

我找到了这个答案: Ubuntu-server通过chroot netplan安装wifi网络无法访问

这似乎奏效了。虽然只过了几个小时,但这是 wifi 三个多月以来保持连接的最长时间,所以我希望这真的是解决方案。

我替换了以下内容:

cat /etc/netplan/01-network-manager-all.yaml
# Let NetworkManager manage all devices on this system
network:
  version: 2
  renderer: NetworkManager

使用以下文件的内容:

cat /usr/share/doc/netplan/examples/wireless.yaml 
network:
  version: 2
  renderer: networkd
  wifis:
    wlp2s0b1:
      regulatory-domain: "GB"
      dhcp4: no
      dhcp6: no
      addresses: [192.168.0.21/24]
      nameservers:
        addresses: [192.168.0.1, 8.8.8.8]
      access-points:
        "network_ssid_name":
          password: "**********"
      routes:
        - to: default
          via: 192.168.0.1

我只是复制了它(包括星号)。但将wlp2s0b1:笔记本电脑上的 wifi 更改为 wifi。然后我运行

sudo netplan apply

一开始好像没什么反应。大约 5 分钟后,WiFi 重新连接,并且到现在还没有消失。

相关内容