我的 Ubuntu 中的网络连接不断断开。我一直在运行 Ubuntu 18.04,没有任何问题。但是当我升级到 22.04 时,网络不稳定,不断断开连接。
我几乎尝试了针对 Realtek 8169/8168 问题建议的所有解决方案。
我已经从 Realtek 的源代码编译了内核模块 r8168。这就是我现在使用的。但问题仍然存在。
以下是一些输出。
$ sudo lspci
00:00.0 Host bridge: Intel Corporation 4th Gen Core Processor DRAM Controller (rev 06)
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor PCI Express x16 Controller (rev 06)
00:14.0 USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB xHCI (rev 05)
00:16.0 Communication controller: Intel Corporation 8 Series/C220 Series Chipset Family MEI Controller #1 (rev 04)
00:1a.0 USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB EHCI #2 (rev 05)
00:1b.0 Audio device: Intel Corporation 8 Series/C220 Series Chipset High Definition Audio Controller (rev 05)
00:1c.0 PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #1 (rev d5)
00:1c.5 PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #6 (rev d5)
00:1c.6 PCI bridge: Intel Corporation 82801 PCI Bridge (rev d5)
00:1d.0 USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB EHCI #1 (rev 05)
00:1f.0 ISA bridge: Intel Corporation B85 Express LPC Controller (rev 05)
00:1f.2 SATA controller: Intel Corporation 8 Series/C220 Series Chipset Family 6-port SATA Controller 1 [AHCI mode] (rev 05)
00:1f.3 SMBus: Intel Corporation 8 Series/C220 Series Chipset Family SMBus Controller (rev 05)
01:00.0 VGA compatible controller: NVIDIA Corporation GM206 [GeForce GTX 950] (rev a1)
01:00.1 Audio device: NVIDIA Corporation GM206 High Definition Audio Controller (rev a1)
03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 0c)
04:00.0 PCI bridge: ASMedia Technology Inc. ASM1083/1085 PCIe to PCI Bridge (rev 03)
$ sudo lshw -c 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:03:00.0
logical name: enp3s0
version: 0c
serial: d8:cb:8a:7c:29:e8
size: 100Mbit/s
capacity: 1Gbit/s
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=r8168 driverversion=8.050.03-NAPI duplex=full ip=192.168.1.20 latency=0 link=yes multicast=yes port=twisted pair speed=100Mbit/s
resources: irq:29 ioport:d000(size=256) memory:f7100000-f7100fff memory:f2100000-f2103fff
这是系统日志,大约 100 行,包含连接和断开连接的完整循环。
Aug 9 07:27:34 eryd-MS-7850 NetworkManager[927]: <info> [1660004854.0148] manager: NetworkManager state is now CONNECTED_GLOBAL
Aug 9 07:27:41 eryd-MS-7850 kernel: [ 1465.847814] r8168: enp3s0: link down
Aug 9 07:27:42 eryd-MS-7850 google-chrome.desktop[3591]: [3585:3635:0809/072742.141251:ERROR:connection_factory_impl.cc(425)] Failed to connect to MCS endpoint with error -106
Aug 9 07:27:44 eryd-MS-7850 systemd[1]: NetworkManager-dispatcher.service: Deactivated successfully.
Aug 9 07:27:47 eryd-MS-7850 NetworkManager[927]: <info> [1660004867.6392] device (enp3s0): state change: activated -> unavailable (reason 'carrier-changed', sys-iface-state: 'managed')
Aug 9 07:27:47 eryd-MS-7850 NetworkManager[927]: <info> [1660004867.6625] dhcp4 (enp3s0): canceled DHCP transaction
Aug 9 07:27:47 eryd-MS-7850 NetworkManager[927]: <info> [1660004867.6626] dhcp4 (enp3s0): activation: beginning transaction (timeout in 45 seconds)
Aug 9 07:27:47 eryd-MS-7850 NetworkManager[927]: <info> [1660004867.6627] dhcp4 (enp3s0): state changed no lease
Aug 9 07:27:47 eryd-MS-7850 avahi-daemon[924]: Withdrawing address record for 192.168.1.20 on enp3s0.
Aug 9 07:27:47 eryd-MS-7850 avahi-daemon[924]: Leaving mDNS multicast group on interface enp3s0.IPv4 with address 192.168.1.20.
Aug 9 07:27:47 eryd-MS-7850 avahi-daemon[924]: Interface enp3s0.IPv4 no longer relevant for mDNS.
Aug 9 07:27:47 eryd-MS-7850 avahi-daemon[924]: Withdrawing address record for fe80::3086:833a:bbb2:159c on enp3s0.
Aug 9 07:27:47 eryd-MS-7850 avahi-daemon[924]: Leaving mDNS multicast group on interface enp3s0.IPv6 with address fe80::3086:833a:bbb2:159c.
Aug 9 07:27:47 eryd-MS-7850 avahi-daemon[924]: Interface enp3s0.IPv6 no longer relevant for mDNS.
Aug 9 07:27:47 eryd-MS-7850 systemd-resolved[910]: enp3s0: Bus client set default route setting: no
Aug 9 07:27:47 eryd-MS-7850 systemd-resolved[910]: enp3s0: Bus client reset DNS server list.
Aug 9 07:27:47 eryd-MS-7850 NetworkManager[927]: <info> [1660004867.6918] manager: NetworkManager state is now DISCONNECTED
Aug 9 07:27:47 eryd-MS-7850 dbus-daemon[926]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service' requested by ':1.13' (uid=0 pid=927 comm="/usr/sbin/NetworkManager --no-daemon " label="unconfined")
Aug 9 07:27:47 eryd-MS-7850 systemd[1]: Starting Network Manager Script Dispatcher Service...
Aug 9 07:27:47 eryd-MS-7850 dbus-daemon[926]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Aug 9 07:27:47 eryd-MS-7850 systemd[1]: Started Network Manager Script Dispatcher Service.
Aug 9 07:27:55 eryd-MS-7850 kernel: [ 1480.199062] r8168: enp3s0: link up
Aug 9 07:27:55 eryd-MS-7850 NetworkManager[927]: <info> [1660004875.9630] device (enp3s0): carrier: link connected
Aug 9 07:27:55 eryd-MS-7850 NetworkManager[927]: <info> [1660004875.9637] device (enp3s0): state change: unavailable -> disconnected (reason 'carrier-changed', sys-iface-state: 'managed')
Aug 9 07:27:55 eryd-MS-7850 NetworkManager[927]: <info> [1660004875.9650] policy: auto-activating connection 'Wired connection 1' (947deb8a-c0e0-3198-ba39-27d402838c7b)
Aug 9 07:27:55 eryd-MS-7850 NetworkManager[927]: <info> [1660004875.9654] device (enp3s0): Activation: starting connection 'Wired connection 1' (947deb8a-c0e0-3198-ba39-27d402838c7b)
Aug 9 07:27:55 eryd-MS-7850 NetworkManager[927]: <info> [1660004875.9655] device (enp3s0): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed')
Aug 9 07:27:55 eryd-MS-7850 NetworkManager[927]: <info> [1660004875.9659] manager: NetworkManager state is now CONNECTING
Aug 9 07:27:55 eryd-MS-7850 NetworkManager[927]: <info> [1660004875.9660] device (enp3s0): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
Aug 9 07:27:55 eryd-MS-7850 NetworkManager[927]: <info> [1660004875.9662] device (enp3s0): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed')
Aug 9 07:27:55 eryd-MS-7850 NetworkManager[927]: <info> [1660004875.9667] dhcp4 (enp3s0): activation: beginning transaction (timeout in 45 seconds)
Aug 9 07:27:55 eryd-MS-7850 avahi-daemon[924]: Joining mDNS multicast group on interface enp3s0.IPv6 with address fe80::3086:833a:bbb2:159c.
Aug 9 07:27:55 eryd-MS-7850 avahi-daemon[924]: New relevant interface enp3s0.IPv6 for mDNS.
Aug 9 07:27:55 eryd-MS-7850 avahi-daemon[924]: Registering new address record for fe80::3086:833a:bbb2:159c on enp3s0.*.
Aug 9 07:27:57 eryd-MS-7850 NetworkManager[927]: <info> [1660004877.0088] dhcp4 (enp3s0): state changed new lease, address=192.168.1.20
Aug 9 07:27:57 eryd-MS-7850 avahi-daemon[924]: Joining mDNS multicast group on interface enp3s0.IPv4 with address 192.168.1.20.
Aug 9 07:27:57 eryd-MS-7850 avahi-daemon[924]: New relevant interface enp3s0.IPv4 for mDNS.
Aug 9 07:27:57 eryd-MS-7850 avahi-daemon[924]: Registering new address record for 192.168.1.20 on enp3s0.IPv4.
Aug 9 07:27:57 eryd-MS-7850 NetworkManager[927]: <info> [1660004877.0114] device (enp3s0): state change: ip-config -> ip-check (reason 'none', sys-iface-state: 'managed')
Aug 9 07:27:57 eryd-MS-7850 NetworkManager[927]: <info> [1660004877.0130] device (enp3s0): state change: ip-check -> secondaries (reason 'none', sys-iface-state: 'managed')
Aug 9 07:27:57 eryd-MS-7850 NetworkManager[927]: <info> [1660004877.0133] device (enp3s0): state change: secondaries -> activated (reason 'none', sys-iface-state: 'managed')
Aug 9 07:27:57 eryd-MS-7850 NetworkManager[927]: <info> [1660004877.0135] manager: NetworkManager state is now CONNECTED_LOCAL
Aug 9 07:27:57 eryd-MS-7850 NetworkManager[927]: <info> [1660004877.0138] manager: NetworkManager state is now CONNECTED_SITE
Aug 9 07:27:57 eryd-MS-7850 NetworkManager[927]: <info> [1660004877.0139] policy: set 'Wired connection 1' (enp3s0) as default for IPv4 routing and DNS
Aug 9 07:27:57 eryd-MS-7850 NetworkManager[927]: <info> [1660004877.0144] device (enp3s0): Activation: successful, device activated.
Aug 9 07:27:57 eryd-MS-7850 systemd-resolved[910]: enp3s0: Bus client set default route setting: yes
Aug 9 07:27:57 eryd-MS-7850 systemd-resolved[910]: enp3s0: Bus client set DNS server list to: 202.73.99.2, 118.136.64.5, 111.95.141.4
Aug 9 07:27:57 eryd-MS-7850 NetworkManager[927]: <info> [1660004877.5251] manager: NetworkManager state is now CONNECTED_GLOBAL
Aug 9 07:28:05 eryd-MS-7850 kernel: [ 1489.399148] r8168: enp3s0: link down
Aug 9 07:28:05 eryd-MS-7850 google-chrome.desktop[3591]: [3585:3635:0809/072805.692732:ERROR:connection_factory_impl.cc(425)] Failed to connect to MCS endpoint with error -106
Aug 9 07:28:07 eryd-MS-7850 systemd[1]: NetworkManager-dispatcher.service: Deactivated successfully.
Aug 9 07:28:11 eryd-MS-7850 NetworkManager[927]: <info> [1660004891.1911] device (enp3s0): state change: activated -> unavailable (reason 'carrier-changed', sys-iface-state: 'managed')
Aug 9 07:28:11 eryd-MS-7850 NetworkManager[927]: <info> [1660004891.2064] dhcp4 (enp3s0): canceled DHCP transaction
Aug 9 07:28:11 eryd-MS-7850 NetworkManager[927]: <info> [1660004891.2064] dhcp4 (enp3s0): activation: beginning transaction (timeout in 45 seconds)
Aug 9 07:28:11 eryd-MS-7850 NetworkManager[927]: <info> [1660004891.2064] dhcp4 (enp3s0): state changed no lease
Aug 9 07:28:11 eryd-MS-7850 avahi-daemon[924]: Withdrawing address record for 192.168.1.20 on enp3s0.
Aug 9 07:28:11 eryd-MS-7850 avahi-daemon[924]: Leaving mDNS multicast group on interface enp3s0.IPv4 with address 192.168.1.20.
Aug 9 07:28:11 eryd-MS-7850 avahi-daemon[924]: Interface enp3s0.IPv4 no longer relevant for mDNS.
Aug 9 07:28:11 eryd-MS-7850 avahi-daemon[924]: Withdrawing address record for fe80::3086:833a:bbb2:159c on enp3s0.
Aug 9 07:28:11 eryd-MS-7850 avahi-daemon[924]: Leaving mDNS multicast group on interface enp3s0.IPv6 with address fe80::3086:833a:bbb2:159c.
Aug 9 07:28:11 eryd-MS-7850 avahi-daemon[924]: Interface enp3s0.IPv6 no longer relevant for mDNS.
Aug 9 07:28:11 eryd-MS-7850 systemd-resolved[910]: enp3s0: Bus client set default route setting: no
Aug 9 07:28:11 eryd-MS-7850 systemd-resolved[910]: enp3s0: Bus client reset DNS server list.
Aug 9 07:28:11 eryd-MS-7850 NetworkManager[927]: <info> [1660004891.2308] manager: NetworkManager state is now DISCONNECTED
Aug 9 07:28:11 eryd-MS-7850 dbus-daemon[926]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service' requested by ':1.13' (uid=0 pid=927 comm="/usr/sbin/NetworkManager --no-daemon " label="unconfined")
Aug 9 07:28:11 eryd-MS-7850 systemd[1]: Starting Network Manager Script Dispatcher Service...
Aug 9 07:28:11 eryd-MS-7850 dbus-daemon[926]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Aug 9 07:28:11 eryd-MS-7850 systemd[1]: Started Network Manager Script Dispatcher Service.
Aug 9 07:28:19 eryd-MS-7850 kernel: [ 1503.750370] r8168: enp3s0: link up
Aug 9 07:28:19 eryd-MS-7850 NetworkManager[927]: <info> [1660004899.5144] device (enp3s0): carrier: link connected
Aug 9 07:28:19 eryd-MS-7850 NetworkManager[927]: <info> [1660004899.5149] device (enp3s0): state change: unavailable -> disconnected (reason 'carrier-changed', sys-iface-state: 'managed')
Aug 9 07:28:19 eryd-MS-7850 NetworkManager[927]: <info> [1660004899.5162] policy: auto-activating connection 'Wired connection 1' (947deb8a-c0e0-3198-ba39-27d402838c7b)
Aug 9 07:28:19 eryd-MS-7850 NetworkManager[927]: <info> [1660004899.5166] device (enp3s0): Activation: starting connection 'Wired connection 1' (947deb8a-c0e0-3198-ba39-27d402838c7b)
Aug 9 07:28:19 eryd-MS-7850 NetworkManager[927]: <info> [1660004899.5167] device (enp3s0): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed')
Aug 9 07:28:19 eryd-MS-7850 NetworkManager[927]: <info> [1660004899.5168] manager: NetworkManager state is now CONNECTING
Aug 9 07:28:19 eryd-MS-7850 NetworkManager[927]: <info> [1660004899.5170] device (enp3s0): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
Aug 9 07:28:19 eryd-MS-7850 NetworkManager[927]: <info> [1660004899.5173] device (enp3s0): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed')
Aug 9 07:28:19 eryd-MS-7850 NetworkManager[927]: <info> [1660004899.5177] dhcp4 (enp3s0): activation: beginning transaction (timeout in 45 seconds)
Aug 9 07:28:19 eryd-MS-7850 avahi-daemon[924]: Joining mDNS multicast group on interface enp3s0.IPv6 with address fe80::3086:833a:bbb2:159c.
Aug 9 07:28:19 eryd-MS-7850 avahi-daemon[924]: New relevant interface enp3s0.IPv6 for mDNS.
Aug 9 07:28:19 eryd-MS-7850 avahi-daemon[924]: Registering new address record for fe80::3086:833a:bbb2:159c on enp3s0.*.
Aug 9 07:28:20 eryd-MS-7850 NetworkManager[927]: <info> [1660004900.5561] dhcp4 (enp3s0): state changed new lease, address=192.168.1.20
Aug 9 07:28:20 eryd-MS-7850 avahi-daemon[924]: Joining mDNS multicast group on interface enp3s0.IPv4 with address 192.168.1.20.
Aug 9 07:28:20 eryd-MS-7850 avahi-daemon[924]: New relevant interface enp3s0.IPv4 for mDNS.
Aug 9 07:28:20 eryd-MS-7850 avahi-daemon[924]: Registering new address record for 192.168.1.20 on enp3s0.IPv4.
Aug 9 07:28:20 eryd-MS-7850 NetworkManager[927]: <info> [1660004900.5591] device (enp3s0): state change: ip-config -> ip-check (reason 'none', sys-iface-state: 'managed')
Aug 9 07:28:20 eryd-MS-7850 NetworkManager[927]: <info> [1660004900.5611] device (enp3s0): state change: ip-check -> secondaries (reason 'none', sys-iface-state: 'managed')
Aug 9 07:28:20 eryd-MS-7850 NetworkManager[927]: <info> [1660004900.5613] device (enp3s0): state change: secondaries -> activated (reason 'none', sys-iface-state: 'managed')
Aug 9 07:28:20 eryd-MS-7850 NetworkManager[927]: <info> [1660004900.5616] manager: NetworkManager state is now CONNECTED_LOCAL
Aug 9 07:28:20 eryd-MS-7850 NetworkManager[927]: <info> [1660004900.5618] manager: NetworkManager state is now CONNECTED_SITE
Aug 9 07:28:20 eryd-MS-7850 NetworkManager[927]: <info> [1660004900.5619] policy: set 'Wired connection 1' (enp3s0) as default for IPv4 routing and DNS
Aug 9 07:28:20 eryd-MS-7850 NetworkManager[927]: <info> [1660004900.5623] device (enp3s0): Activation: successful, device activated.
Aug 9 07:28:20 eryd-MS-7850 systemd-resolved[910]: enp3s0: Bus client set default route setting: yes
Aug 9 07:28:20 eryd-MS-7850 systemd-resolved[910]: enp3s0: Bus client set DNS server list to: 202.73.99.2, 118.136.64.5, 111.95.141.4
Aug 9 07:28:21 eryd-MS-7850 NetworkManager[927]: <info> [1660004901.0531] manager: NetworkManager state is now CONNECTED_GLOBAL