我开始遇到一个奇怪的问题。我通常通过 RJ45 连接,但在我写这篇文章时,我被迫改用 Wifi。
事情是这样的,我注意到最近当从暂停状态恢复时,我基本上必须重新启动才能再次获得互联网连接。
第二次之后,我决定深入研究为什么会发生这种情况。以下是我目前尝试的方法:
sudo lshw -C network
输出:
*-network
description: Wireless interface
product: Dual Band Wireless-AC 3168NGW [Stone Peak]
vendor: Intel Corporation
physical id: 0
bus info: pci@0000:02:00.0
logical name: wlp2s0
version: 10
serial: 1c:4d:70:8b:e1:97
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
configuration: broadcast=yes driver=iwlwifi driverversion=5.11.0-27-generic firmware=29.1654887522.0 3168-29.ucode ip=192.168.1.144 latency=0 link=yes multicast=yes wireless=IEEE 802.11
resources: irq:126 memory:df200000-df201fff
*-network DISABLED
description: Ethernet interface
product: QCA8171 Gigabit Ethernet
vendor: Qualcomm Atheros
physical id: 0
bus info: pci@0000:03:00.0
logical name: enp3s0
version: 10
serial: 4c:cc:6a:e2:a9:77
width: 64 bits
clock: 33MHz
capabilities: pm pciexpress msi msix bus_master cap_list ethernet physical
configuration: broadcast=yes driver=alx latency=0 multicast=yes
resources: irq:19 memory:df100000-df13ffff ioport:d000(size=128)
如您所见,enp3s0 设备已被禁用...因此,如果我尝试启动它:
sudo ip link set enp3s0 up
我明白了:
RTNETLINK answers: No such device
搜索有关此错误的信息并没有提供太多帮助。
然后,我尝试通过 NetWorkManager 重新启动 netplan,以下是我的文件内容:
sudo cat /etc/netplan/01-network-manager-all.yaml
# Let NetworkManager manage all devices on this system
network:
version: 2
renderer: NetworkManager
ethernets:
enp3s0:
dhcp4: true
然后应用并重新启动 NetworkManager 服务
sudo netplan apply
sudo systemctl restart NetworkManager.service
但还是没运气。检查 UI 时,我注意到以下情况:
这很奇怪...不确定为什么列出那么多??
如果我点击其中任意一个,就会出现这个
检查设置后我看到:
我不确定这里到底发生了什么...尝试检查 dmesg,但我没有看到与此界面相关的具体错误
dmesg | grep -e etwork -e enp
[ 2695.416481] alx 0000:03:00.0 enp3s0: wol: ctrl=3, speed=A
[12199.099371] alx 0000:03:00.0 enp3s0: wol: ctrl=3, speed=A
[15886.753884] alx 0000:03:00.0 enp3s0: wol: ctrl=3, speed=A
[26846.775196] alx 0000:03:00.0 enp3s0: wol: ctrl=3, speed=A
[26877.043272] alx 0000:03:00.0 enp3s0: wol: ctrl=3, speed=A
[36094.086555] alx 0000:03:00.0 enp3s0: wol: ctrl=3, speed=A
[36124.365270] alx 0000:03:00.0 enp3s0: wol: ctrl=3, speed=A
[57796.358176] alx 0000:03:00.0 enp3s0: wol: ctrl=3, speed=A
[68289.487047] alx 0000:03:00.0 enp3s0: wol: ctrl=3, speed=A
[77002.517657] alx 0000:03:00.0 enp3s0: wol: ctrl=3, speed=A
重新启动后,我看到的内容如下:
sudo lshw -C network
[sudo] password for internetmosquito:
*-network DISABLED
description: Wireless interface
product: Dual Band Wireless-AC 3168NGW [Stone Peak]
vendor: Intel Corporation
physical id: 0
bus info: pci@0000:02:00.0
logical name: wlp2s0
version: 10
serial: 1c:4d:70:8b:e1:97
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
configuration: broadcast=yes driver=iwlwifi driverversion=5.11.0-27-generic firmware=29.1654887522.0 3168-29.ucode latency=0 link=no multicast=yes wireless=IEEE 802.11
resources: irq:126 memory:df200000-df201fff
*-network
description: Ethernet interface
product: QCA8171 Gigabit Ethernet
vendor: Qualcomm Atheros
physical id: 0
bus info: pci@0000:03:00.0
logical name: enp3s0
version: 10
serial: 4c:cc:6a:e2:a9:77
size: 1Gbit/s
capacity: 1Gbit/s
width: 64 bits
clock: 33MHz
capabilities: pm pciexpress msi msix bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=alx driverversion=5.11.0-27-generic duplex=full ip=192.168.1.141 latency=0 link=yes multicast=yes port=twisted pair speed=1Gbit/s
resources: irq:19 memory:df100000-df13ffff ioport:d000(size=128)
sudo ip link show enp3s0
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether 4c:cc:6a:e2:a9:77 brd ff:ff:ff:ff:ff:ff
然后再次进入 UI:
知道这里可能发生了什么吗?必须重新启动才能解决问题简直是一场噩梦……挂起和唤醒时发生了什么导致这种情况?
答案1
编辑 /etc/netplan/01-network-manager-all.yaml 如下:
# Let NetworkManager manage all devices on this system
network:
version: 2
renderer: NetworkManager
sudo netplan generate
sudo netplan apply
调出网络设置面板。
单击 的齿轮图标netplan-enp3s0
,然后Wired Connection 1
单击 ,并单击Remove Connection Profile按钮以查看两个示例。
重新启动计算机。
再次打开网络设置面板。
Wired Connection
如果尚不存在配置文件,请单击 + 图标以创建新配置文件。检查“身份”选项卡的 MAC 地址是否如下所示...如果不是,请单击向下箭头...
检查其他选项卡中的所有其他设置是否合适。
Apply個人Wired Connection
資料。
关闭网络设置面板。
Wired Connection
从网络下拉菜单中选择。
更新#1:
看https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1931301条目 #23。基本上,将您的 21.04 更新到最新内核 5.11.0-34.36(发布于 9/7/21)。这样就解决了问题。