从 Windows 10 重新启动到 Linux 后,eth 网络无连接

从 Windows 10 重新启动到 Linux 后,eth 网络无连接

我双启动 Windows 10 和 EndeavourOS。不知何故,Windows 弄乱了我的网卡,因此在启动 Linux 时,我无法访问网络。当我第一次遇到这个问题时,我重新安装了 EndeavourOS,它又工作正常了。但仅限于下次 Windows 启动和连续的 Linux 再次启动。

此外,从 EndeavourOS live USB 记忆棒启动时,NIC 工作正常。

这就是网卡:

[me@pc ~]$ /usr/bin/lspci | /bin/egrep -i 'network|ethernet'
01:00.1 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 1a)

我发现很多相当旧的线程建议关闭 Win 10 中的各种 LAN 唤醒和其他电源设置,我尝试了所有这些,但没有成功。

有趣的是,NIC 似乎确实通过 DHCP 获得了正确的 IP 地址。

登录 KDE 后,NIC 会记住其最后的 DHCP 配置,看起来:

[me@pc ~]$ ip a
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: enp1s0f1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether e0:4f:43:e8:12:e3 brd ff:ff:ff:ff:ff:ff
    inet 192.168.99.10/24 brd 192.168.99.255 scope global dynamic noprefixroute enp1s0f1
       valid_lft 43007sec preferred_lft 43007sec
    inet6 fe80::48e3:71dd:df1b:797b/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 9a:11:4e:51:2b:86 brd ff:ff:ff:ff:ff:ff permaddr 9c:fc:e8:dd:b1:2f

但是,没有连接到网络:

[me@pc ~]$ ping 192.168.99.10
PING 192.168.99.10 (192.168.99.10) 56(84) bytes of data.
64 bytes from 192.168.99.10: icmp_seq=1 ttl=64 time=0.031 ms
64 bytes from 192.168.99.10: icmp_seq=2 ttl=64 time=0.058 ms
64 bytes from 192.168.99.10: icmp_seq=3 ttl=64 time=0.057 ms
^C
--- 192.168.99.10 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2053ms
rtt min/avg/max/mdev = 0.031/0.048/0.058/0.012 ms

[me@pc ~]$ ping 192.168.99.1
PING 192.168.99.1 (192.168.99.1) 56(84) bytes of data.
From 192.168.99.10 icmp_seq=1 Destination Host Unreachable
From 192.168.99.10 icmp_seq=2 Destination Host Unreachable
From 192.168.99.10 icmp_seq=3 Destination Host Unreachable
^C
--- 192.168.99.1 ping statistics ---
6 packets transmitted, 0 received, +3 errors, 100% packet loss, time 5226ms
pipe 3
[me@pc ~]$ sudo dmesg | grep r8168
[    6.133867] r8168: loading out-of-tree module taints kernel.
[    6.242244] r8168: module verification failed: signature and/or required key missing - tainting kernel
[    6.244316] r8168 Gigabit Ethernet driver 8.048.03-NAPI loaded
[    6.262759] r8168: This product is covered by one or more of the following patents: US6,570,884, US6,115,776, and US6,327,625.
[    6.264779] r8168  Copyright (C) 2020  Realtek NIC software team <[email protected]> 
[    6.512649] r8168 0000:01:00.1 enp1s0f1: renamed from eth0
[   10.578772] r8168: enp1s0f1: link up

我还尝试切换到稍旧版本的 r8168 模块 (lts),但无济于事。

我记得它可以工作,在 Windows 和 Linux 之间来回切换,但此时只有重新安装似乎有帮助。当然,我想规避这一点。即使这意味着在启动或其他黑客攻击期间以某种方式重置网卡。

编辑

新证据:

我通过 NetworkManager 手动配置网卡,现在它不断断开连接并再次连接:

Apr 13 10:40:27 pc NetworkManager[487]: <info>  [1618303227.2299] manager: NetworkManager state is now CONNECTING
Apr 13 10:40:27 pc NetworkManager[487]: <info>  [1618303227.2513] device (enp1s0f1): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
Apr 13 10:40:27 pc NetworkManager[487]: <info>  [1618303227.2520] device (enp1s0f1): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed')
Apr 13 10:40:27 pc NetworkManager[487]: <info>  [1618303227.2546] device (enp1s0f1): state change: ip-config -> ip-check (reason 'none', sys-iface-state: 'managed')
Apr 13 10:40:27 pc NetworkManager[487]: <info>  [1618303227.2587] device (enp1s0f1): state change: ip-check -> secondaries (reason 'none', sys-iface-state: 'managed')
Apr 13 10:40:27 pc NetworkManager[487]: <info>  [1618303227.2589] device (enp1s0f1): state change: secondaries -> activated (reason 'none', sys-iface-state: 'managed')
Apr 13 10:40:27 pc NetworkManager[487]: <info>  [1618303227.2596] manager: NetworkManager state is now CONNECTED_LOCAL
Apr 13 10:40:27 pc NetworkManager[487]: <info>  [1618303227.2605] manager: NetworkManager state is now CONNECTED_SITE
Apr 13 10:40:27 pc NetworkManager[487]: <info>  [1618303227.2607] policy: set 'Wired connection 1' (enp1s0f1) as default for IPv4 routing and DNS
Apr 13 10:40:27 pc NetworkManager[487]: <info>  [1618303227.2640] device (enp1s0f1): Activation: successful, device activated.
Apr 13 10:40:35 pc NetworkManager[487]: <info>  [1618303235.3135] device (enp1s0f1): carrier: link connected
Apr 13 10:40:35 pc NetworkManager[487]: <info>  [1618303235.3142] device (enp1s0f1): state change: activated -> unavailable (reason 'carrier-changed', sys-iface-state: 'managed')
Apr 13 10:40:35 pc NetworkManager[487]: <info>  [1618303235.3667] manager: NetworkManager state is now CONNECTED_LOCAL
Apr 13 10:40:35 pc NetworkManager[487]: <info>  [1618303235.3678] manager: NetworkManager state is now DISCONNECTED
Apr 13 10:40:40 pc NetworkManager[487]: <info>  [1618303240.3191] device (enp1s0f1): state change: unavailable -> disconnected (reason 'none', sys-iface-state: 'managed')
Apr 13 10:40:40 pc NetworkManager[487]: <info>  [1618303240.3223] policy: auto-activating connection 'Wired connection 1' (e76e5718-9a47-3733-818b-30aaa862bcf4)
Apr 13 10:40:40 pc NetworkManager[487]: <info>  [1618303240.3235] device (enp1s0f1): Activation: starting connection 'Wired connection 1' (e76e5718-9a47-3733-818b-30aaa862bcf4)
Apr 13 10:40:40 pc NetworkManager[487]: <info>  [1618303240.3238] device (enp1s0f1): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed')
Apr 13 10:40:40 pc NetworkManager[487]: <info>  [1618303240.3247] manager: NetworkManager state is now CONNECTING
...start all over

所以 NIC 本身现在可以工作,但只是在一定程度上:

[me@pc ~]$ ping 192.168.99.1
PING 192.168.99.1 (192.168.99.1) 56(84) bytes of data.
ping: sendmsg: Network is unreachable
ping: sendmsg: Network is unreachable
ping: sendmsg: Network is unreachable
ping: sendmsg: Network is unreachable
From 192.168.99.8 icmp_seq=12 Destination Host Unreachable
From 192.168.99.8 icmp_seq=13 Destination Host Unreachable
From 192.168.99.8 icmp_seq=14 Destination Host Unreachable
64 bytes from 192.168.99.1: icmp_seq=15 ttl=64 time=1.65 ms
ping: sendmsg: Network is unreachable
ping: sendmsg: Network is unreachable
ping: sendmsg: Network is unreachable

答案1

回答我自己的问题。

由于我抛弃了 Windows 10 而转而在虚拟机中运行它,我认为我没有修复这个问题,而是规避了它。但今天同样的症状又出现了。经过一番挖掘和尝试不同的 DHCP 客户端而不是 NetworkManager 的内置客户端后,我终于找到了一种解决方案,为我的 NIC 使用另一个驱动程序。

# rmmod r8168

# modprobe r8169

我的以太网又恢复正常了。

通过坚持它

# echo blacklist r8168 > /etc/modprobe.d/r8168.conf
# echo r8169 > /etc/modules-load.d/r8169.conf

以这种方式命名 r8168.conf 对于覆盖 /usr/lib/modprobe.d/r8168.conf 中提供的包配置至关重要。

相关内容