![有线网络不断断开连接几秒钟](https://linux22.com/image/938471/%E6%9C%89%E7%BA%BF%E7%BD%91%E7%BB%9C%E4%B8%8D%E6%96%AD%E6%96%AD%E5%BC%80%E8%BF%9E%E6%8E%A5%E5%87%A0%E7%A7%92%E9%92%9F.png)
每隔几分钟左右,网络连接就会完全断开几秒钟。nload
即使在运行 Minecraft 服务器等程序以保持恒定的网络负载时,我也能看到这种情况,因为几秒钟内没有传入或传出数据。我知道这不是网络问题,因为即使这台电脑断开连接,我的其他电脑也能正常工作。
以下是输出lspci
:
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 0c)
我尝试安装 r8168 驱动程序,但似乎没有帮助,我也尝试重新安装网络管理器并在配置中将管理设置为 true,但没有成功。
我可以看到连接并使用了几分钟,它只是断开了几秒钟,然后像什么都没发生一样重新连接,导致任何网络服务滞后或超时。我目前正在运行 Ubuntu 21.04,但这个问题也发生在 20.04 和 20.10 上。
编辑:
lspci -nn | grep -i 以太网
02:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev 0c)
sudo lshw -C 网络
*-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: 0c
serial: 20:12:9d:20:02:6e
size: 100Mbit/s
capacity: 1Gbit/s
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress msix vpd 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.11.0-18-generic duplex=full firmware=rtl8168g-2_0.0.1 02/06/13 ip=192.168.0.240 latency=0 link=yes multicast=yes port=twisted pair speed=100Mbit/s
resources: irq:18 ioport:e800(size=256) memory:fbdff000-fbdfffff memory:f8ffc000-f8ffffff
ip a | grep mtu
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
2: enp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
发生这种情况的日志
Jun 14 21:31:16 server NetworkManager[810]: <info> [1623724276.7620] device (enp2s0): state change: activated -> unavailable (reason 'carrier-changed', sys-iface-state: 'managed')
Jun 14 21:31:16 server NetworkManager[810]: <info> [1623724276.7770] dhcp4 (enp2s0): canceled DHCP transaction
Jun 14 21:31:16 server NetworkManager[810]: <info> [1623724276.7770] dhcp4 (enp2s0): state changed bound -> done
Jun 14 21:31:16 server NetworkManager[810]: <info> [1623724276.7970] manager: NetworkManager state is now DISCONNECTED
Jun 14 21:31:17 server NetworkManager[810]: <info> [1623724277.1803] device (enp2s0): carrier: link connected
Jun 14 21:31:17 server NetworkManager[810]: <info> [1623724277.1806] device (enp2s0): state change: unavailable -> disconnected (reason 'carrier-changed', sys-iface-state: 'managed')
Jun 14 21:31:17 server NetworkManager[810]: <info> [1623724277.1815] policy: auto-activating connection 'netplan-enp2s0' (7ea6f90b-3495-3533-948a-ef0035687c34)
Jun 14 21:31:17 server NetworkManager[810]: <info> [1623724277.1821] device (enp2s0): Activation: starting connection 'netplan-enp2s0' (7ea6f90b-3495-3533-948a-ef0035687c34)
Jun 14 21:31:17 server NetworkManager[810]: <info> [1623724277.1823] device (enp2s0): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed')
Jun 14 21:31:17 server NetworkManager[810]: <info> [1623724277.1828] manager: NetworkManager state is now CONNECTING
Jun 14 21:31:17 server NetworkManager[810]: <info> [1623724277.1830] device (enp2s0): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
Jun 14 21:31:17 server NetworkManager[810]: <info> [1623724277.1836] device (enp2s0): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed')
Jun 14 21:31:17 server NetworkManager[810]: <info> [1623724277.1840] dhcp4 (enp2s0): activation: beginning transaction (timeout in 45 seconds)
Jun 14 21:31:19 server NetworkManager[810]: <info> [1623724279.1925] dhcp4 (enp2s0): state changed unknown -> bound, address=192.168.0.240
Jun 14 21:31:19 server NetworkManager[810]: <info> [1623724279.1943] device (enp2s0): state change: ip-config -> ip-check (reason 'none', sys-iface-state: 'managed')
Jun 14 21:31:19 server NetworkManager[810]: <info> [1623724279.1985] device (enp2s0): state change: ip-check -> secondaries (reason 'none', sys-iface-state: 'managed')
Jun 14 21:31:19 server NetworkManager[810]: <info> [1623724279.1989] device (enp2s0): state change: secondaries -> activated (reason 'none', sys-iface-state: 'managed')
Jun 14 21:31:19 server NetworkManager[810]: <info> [1623724279.1996] manager: NetworkManager state is now CONNECTED_LOCAL
Jun 14 21:31:19 server NetworkManager[810]: <info> [1623724279.2017] manager: NetworkManager state is now CONNECTED_SITE
Jun 14 21:31:19 server NetworkManager[810]: <info> [1623724279.2019] policy: set 'netplan-enp2s0' (enp2s0) as default for IPv4 routing and DNS
Jun 14 21:31:19 server NetworkManager[810]: <info> [1623724279.2023] policy: set 'netplan-enp2s0' (enp2s0) as default for IPv6 routing and DNS
Jun 14 21:31:19 server NetworkManager[810]: <info> [1623724279.2031] device (enp2s0): Activation: successful, device activated.
Jun 14 21:31:19 server NetworkManager[810]: <info> [1623724279.2041] manager: NetworkManager state is now CONNECTED_GLOBAL
似乎是“运营商变更”导致了这种情况,我会调查此事。
答案1
原来是我的以太网电缆出了问题。我不知道为什么,但它导致了这些断开连接,我换了一条新的 cat6 电缆,从那以后我就再也没有遇到过任何延迟/断开连接的情况。