救命!需要 Wi-Fi 方面的帮助,它总是以奇怪的方式断开连接

救命!需要 Wi-Fi 方面的帮助,它总是以奇怪的方式断开连接

我在 Ubuntu 上使用 WiFi 时遇到了问题。4-6 分钟后,我无法访问互联网,尽管它显示我仍处于连接状态。我在家里的任何其他设备上或使用 Windows 时使用 WiFi 都没有问题。我一直试图使用 Ubuntu 作为我的主要操作系统,但这个 WiFi 问题使它无法使用并且非常麻烦。

lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 1532:0060 Razer USA, Ltd 
Bus 001 Device 003: ID 1532:021e Razer USA, Ltd 
Bus 001 Device 002: ID 1532:0502 Razer USA, Ltd 
Bus 001 Device 005: ID 0b05:17ba ASUSTek Computer, Inc. N10 Nano 802.11n Network Adapter [Realtek RTL8192CU]
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

ifconfig
enp2s0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
    ether 30:9c:23:07:ad:2e  txqueuelen 1000  (Ethernet)
    RX packets 0  bytes 0 (0.0 B)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 0  bytes 0 (0.0 B)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
    inet 127.0.0.1  netmask 255.0.0.0
    inet6 ::1  prefixlen 128  scopeid 0x10<host>
    loop  txqueuelen 1000  (Local Loopback)
    RX packets 498  bytes 43657 (43.6 KB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 498  bytes 43657 (43.6 KB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlx88d7f6061b8e: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
    inet 192.168.1.151  netmask 255.255.255.0  broadcast 192.168.1.255
    inet6 fe80::c6b0:9a6c:5e9f:d9a  prefixlen 64  scopeid 0x20<link>
    ether 88:d7:f6:06:1b:8e  txqueuelen 1000  (Ethernet)
    RX packets 3252  bytes 3121913 (3.1 MB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 2566  bytes 362022 (362.0 KB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

    lsmod | grep rtl
  rtl8xxxu              126976  0
  rtl8192cu              69632  0
  rtl_usb                20480  1 rtl8192cu
  rtl8192c_common        57344  1 rtl8192cu
  rtlwifi                77824  3 rtl_usb,rtl8192c_common,rtl8192cu
  mac80211              782336  4 rtl_usb,rtlwifi,rtl8192cu,rtl8xxxu
  cfg80211              614400  2 mac80211,rtlwifi

编辑:

dmesg | grep -e wlx -e rtl
[   10.281634] usb 1-10: rtl8192cu_parse_efuse: dumping efuse (0x80 bytes):
[   10.281652] usb 1-10: rtl8xxxu: Loading firmware rtlwifi/rtl8192cufw_TMSC.bin
[   11.204169] usbcore: registered new interface driver rtl8xxxu
[   12.142173] rtl8xxxu 1-10:1.0 wlx88d7f6061b8e: renamed from wlan0
[   21.734810] IPv6: ADDRCONF(NETDEV_UP): wlx88d7f6061b8e: link is not ready
[   21.738882] IPv6: ADDRCONF(NETDEV_UP): wlx88d7f6061b8e: link is not ready
[   22.336831] IPv6: ADDRCONF(NETDEV_UP): wlx88d7f6061b8e: link is not ready
[   24.600867] wlx88d7f6061b8e: authenticate with 00:12:2a:87:e8:18
[   24.605979] wlx88d7f6061b8e: send auth to 00:12:2a:87:e8:18 (try 1/3)
[   24.607334] wlx88d7f6061b8e: authenticated
[   24.608168] wlx88d7f6061b8e: associate with 00:12:2a:87:e8:18 (try 1/3)
[   24.615359] wlx88d7f6061b8e: RX AssocResp from 00:12:2a:87:e8:18 (capab=0x431 status=0 aid=15)
[   24.615926] usb 1-10: rtl8xxxu_bss_info_changed: HT supported
[   24.616528] wlx88d7f6061b8e: associated
[   24.616535] IPv6: ADDRCONF(NETDEV_CHANGE): wlx88d7f6061b8e: link becomes ready
[  139.804740] wlx88d7f6061b8e: deauthenticating from 00:12:2a:87:e8:18 by local choice (Reason: 3=DEAUTH_LEAVING)
[  142.096664] wlx88d7f6061b8e: authenticate with 00:12:2a:87:e8:18
[  142.099742] wlx88d7f6061b8e: send auth to 00:12:2a:87:e8:18 (try 1/3)
[  142.104101] wlx88d7f6061b8e: authenticated
[  142.108046] wlx88d7f6061b8e: associate with 00:12:2a:87:e8:18 (try 1/3)
[  142.116296] wlx88d7f6061b8e: RX AssocResp from 00:12:2a:87:e8:18 (capab=0x431 status=0 aid=15)
[  142.116928] usb 1-10: rtl8xxxu_bss_info_changed: HT supported
[  142.117649] wlx88d7f6061b8e: associated
[  190.224452] wlx88d7f6061b8e: disassociated from 00:12:2a:87:e8:18 (Reason: 2=PREV_AUTH_NOT_VALID)
[  191.337207] wlx88d7f6061b8e: authenticate with 00:12:2a:87:e8:18
[  191.343266] wlx88d7f6061b8e: send auth to 00:12:2a:87:e8:18 (try 1/3)
[  191.346611] wlx88d7f6061b8e: authenticated
[  191.348112] wlx88d7f6061b8e: associate with 00:12:2a:87:e8:18 (try 1/3)
[  191.351230] wlx88d7f6061b8e: RX AssocResp from 00:12:2a:87:e8:18 (capab=0x431 status=0 aid=15)
[  191.351815] usb 1-10: rtl8xxxu_bss_info_changed: HT supported
[  191.352555] wlx88d7f6061b8e: associated
[  417.076676] wlx88d7f6061b8e: deauthenticating from 00:12:2a:87:e8:18 by local choice (Reason: 3=DEAUTH_LEAVING)
[  422.665477] wlx88d7f6061b8e: authenticate with 00:12:2a:87:e8:18
[  422.668437] wlx88d7f6061b8e: send auth to 00:12:2a:87:e8:18 (try 1/3)
[  422.669771] wlx88d7f6061b8e: authenticated
[  422.672046] wlx88d7f6061b8e: associate with 00:12:2a:87:e8:18 (try 1/3)
[  422.676420] wlx88d7f6061b8e: RX AssocResp from 00:12:2a:87:e8:18     (capab=0x431 status=0 aid=15)
[  422.676975] usb 1-10: rtl8xxxu_bss_info_changed: HT supported
[  422.677789] wlx88d7f6061b8e: associated

nmcli dev wifi list
*  SSID                              MODE   CHAN  RATE       SIGNAL  BARS  SECURITY  
DIRECT-88-HP DeskJet 4530 series  Infra  13    54 Mbit/s  100     ▂▄▆█  WPA2      
*    NETIASPOT-87E810                  Infra  13    54 Mbit/s  58      ▂▄▆_  WPA1 WPA2 
LLOYD                             Infra  6     54 Mbit/s  54      ▂▄__  WPA2      
VICTORIA                          Infra  11    54 Mbit/s  40      ▂▄__  WPA2 

答案1

如我们所见,华硕无线设备加载了两个可能存在冲突的驱动程序;让我们尝试将其中一个列入黑名单,看看稳定性是否会提高:

sudo -i
echo "blacklist rtl8192cu" >>  /etc/modprobe.d/blacklist.conf
exit 

我还建议更改网络管理器以禁用省电功能:

sudo sed -i 's/3/2/' /etc/NetworkManager/conf.d/*

然后重新启动网络管理器:

sudo service network-manager restart  

有沒有改善?

编辑:出于隐私原因,Ubuntu 17.04(及更高版本)网络管理器的默认设置会导致 USB Wifi 设备的 MAC 地址不断变化。要解决此问题,您只需编辑配置文件,然后重新启动网络管理器服务。

打开终端并运行:

sudo nano /etc/NetworkManager/NetworkManager.conf

在此文件的底部,复制并粘贴以下内容:

[device]
wifi.scan-rand-mac-address=no

仔细校对,保存并关闭文本编辑器并运行:

sudo service network-manager restart

有沒有改善?

相关内容