在 Ubuntu 20.04 中以太网电缆在 Windows 中工作时被拔掉

mr.*_*rre 6 network-manager networking ethernet

抱歉,我不是 Linux 专家。

\n

我刚买了一块新主板;华硕 ROG Strix B550-f Gaming(Wifi),我在 Ubuntu 20.04 中遇到 WiFi 和以太网问题。我的机器上同时安装了 Ubuntu 和 Windows,在 Windows 中一切工作都完美无缺。

\n

我刚刚在 BIOS 中禁用了快速启动,启动到 Windows,重新启动并启动到 Ubuntu,现在 Wifi 似乎可以工作。虽然看起来确实很随意。

\n

我还尝试了各种方法来使以太网正常工作,但 90% 的时间我都遇到“电缆未插入”的情况。有时它会起作用,但这很奇怪。这是一些调试值

\n
\xe2\x9d\xaf uname -sr\nLinux 5.4.0-53-generic\n
Run Code Online (Sandbox Code Playgroud)\n
\xe2\x9d\xaf ifconfig   \nbr-ac361f0ce01c: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500\n        inet 192.168.49.1  netmask 255.255.255.0  broadcast 192.168.49.255\n        ether 02:42:f6:16:5e:18  txqueuelen 0  (Ethernet)\n        RX packets 0  bytes 0 (0.0 B)\n        RX errors 0  dropped 0  overruns 0  frame 0\n        TX packets 0  bytes 0 (0.0 B)\n        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0\n\nbr-c6025e770d8b: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500\n        inet 172.23.0.1  netmask 255.255.0.0  broadcast 172.23.255.255\n        inet6 fe80::42:38ff:fe34:66b3  prefixlen 64  scopeid 0x20<link>\n        ether 02:42:38:34:66:b3  txqueuelen 0  (Ethernet)\n        RX packets 0  bytes 0 (0.0 B)\n        RX errors 0  dropped 0  overruns 0  frame 0\n        TX packets 188  bytes 28806 (28.8 KB)\n        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0\n\ndocker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500\n        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255\n        ether 02:42:11:c5:bc:8d  txqueuelen 0  (Ethernet)\n        RX packets 0  bytes 0 (0.0 B)\n        RX errors 0  dropped 0  overruns 0  frame 0\n        TX packets 0  bytes 0 (0.0 B)\n        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0\n\nenp6s0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500\n        ether 24:4b:fe:5b:75:e9  txqueuelen 1000  (Ethernet)\n        RX packets 0  bytes 0 (0.0 B)\n        RX errors 0  dropped 0  overruns 0  frame 0\n        TX packets 0  bytes 0 (0.0 B)\n        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0\n        device memory 0xfc200000-fc2fffff  \n\nlo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536\n        inet 127.0.0.1  netmask 255.0.0.0\n        inet6 ::1  prefixlen 128  scopeid 0x10<host>\n        loop  txqueuelen 1000  (Local Loopback)\n        RX packets 1986  bytes 192527 (192.5 KB)\n        RX errors 0  dropped 0  overruns 0  frame 0\n        TX packets 1986  bytes 192527 (192.5 KB)\n        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0\n\nveth6cf3b52: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500\n        inet6 fe80::50fe:f9ff:fee2:8d22  prefixlen 64  scopeid 0x20<link>\n        ether 52:fe:f9:e2:8d:22  txqueuelen 0  (Ethernet)\n        RX packets 0  bytes 0 (0.0 B)\n        RX errors 0  dropped 0  overruns 0  frame 0\n        TX packets 234  bytes 34831 (34.8 KB)\n        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0\n\nwlp5s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500\n        inet 192.168.9.127  netmask 255.255.255.0  broadcast 192.168.9.255\n        inet6 fe80::da03:df99:d9b4:2c69  prefixlen 64  scopeid 0x20<link>\n        ether a8:7e:ea:33:04:eb  txqueuelen 1000  (Ethernet)\n        RX packets 319841  bytes 465543077 (465.5 MB)\n        RX errors 0  dropped 0  overruns 0  frame 0\n        TX packets 45130  bytes 6174880 (6.1 MB)\n        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0\n
Run Code Online (Sandbox Code Playgroud)\n
\xe2\x9d\xaf dmesg | grep eth\n[    1.168629] igc 0000:06:00.0 eth0: MAC: 24:4b:fe:5b:75:e9\n[    1.169098] igc 0000:06:00.0 enp6s0: renamed from eth0\n[   14.753497] br-c6025e770d8b: port 1(veth6cf3b52) entered blocking state\n[   14.753500] br-c6025e770d8b: port 1(veth6cf3b52) entered disabled state\n[   14.753579] device veth6cf3b52 entered promiscuous mode\n[   14.753705] br-c6025e770d8b: port 1(veth6cf3b52) entered blocking state\n[   14.753706] br-c6025e770d8b: port 1(veth6cf3b52) entered forwarding state\n[   14.754075] br-c6025e770d8b: port 1(veth6cf3b52) entered disabled state\n[   14.999187] eth0: renamed from vethd33a5f6\n[   15.035135] IPv6: ADDRCONF(NETDEV_CHANGE): veth6cf3b52: link becomes ready\n[   15.035175] br-c6025e770d8b: port 1(veth6cf3b52) entered blocking state\n[   15.035176] br-c6025e770d8b: port 1(veth6cf3b52) entered forwarding state\n
Run Code Online (Sandbox Code Playgroud)\n
\xe2\x9d\xaf sudo lshw -c network                             \n  *-network                 \n       description: Wireless interface\n       product: Wi-Fi 6 AX200\n       vendor: Intel Corporation\n       physical id: 0\n       bus info: pci@0000:05:00.0\n       logical name: wlp5s0\n       version: 1a\n       serial: a8:7e:ea:33:04:eb\n       width: 64 bits\n       clock: 33MHz\n       capabilities: pm msi pciexpress msix bus_master cap_list ethernet physical wireless\n       configuration: broadcast=yes driver=iwlwifi driverversion=5.4.0-53-generic firmware=48.4fa0041f.0 ip=192.168.9.127 latency=0 link=yes multicast=yes wireless=IEEE 802.11\n       resources: irq:33 memory:fc400000-fc403fff\n  *-network\n       description: Ethernet interface\n       product: Intel Corporation\n       vendor: Intel Corporation\n       physical id: 0\n       bus info: pci@0000:06:00.0\n       logical name: enp6s0\n       version: 02\n       serial: 24:4b:fe:5b:75:e9\n       capacity: 1Gbit/s\n       width: 32 bits\n       clock: 33MHz\n       capabilities: pm msi msix pciexpress bus_master cap_list ethernet physical 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation\n       configuration: autonegotiation=on broadcast=yes driver=igc driverversion=0.0.1-k latency=0 link=no multicast=yes port=twisted pair\n       resources: irq:37 memory:fc200000-fc2fffff memory:fc300000-fc303fff\n  *-network:0\n       description: Ethernet interface\n       physical id: 1\n       logical name: docker0\n       serial: 02:42:11:c5:bc:8d\n       capabilities: ethernet physical\n       configuration: broadcast=yes driver=bridge driverversion=2.3 firmware=N/A ip=172.17.0.1 link=no multicast=yes\n  *-network:1\n       description: Ethernet interface\n       physical id: 2\n       logical name: veth6cf3b52\n       serial: 52:fe:f9:e2:8d:22\n       size: 10Gbit/s\n       capabilities: ethernet physical\n       configuration: autonegotiation=off broadcast=yes driver=veth driverversion=1.0 duplex=full link=yes multicast=yes port=twisted pair speed=10Gbit/s\n  *-network:2\n       description: Ethernet interface\n       physical id: 3\n       logical name: br-c6025e770d8b\n       serial: 02:42:38:34:66:b3\n       capabilities: ethernet physical\n       configuration: broadcast=yes driver=bridge driverversion=2.3 firmware=N/A ip=172.23.0.1 link=yes multicast=yes\n  *-network:3\n       description: Ethernet interface\n       physical id: 4\n       logical name: br-ac361f0ce01c\n       serial: 02:42:f6:16:5e:18\n       capabilities: ethernet physical\n       configuration: broadcast=yes driver=bridge driverversion=2.3 firmware=N/A ip=192.168.49.1 link=no multicast=yes\n
Run Code Online (Sandbox Code Playgroud)\n
\xe2\x9d\xaf cat /etc/NetworkManager/NetworkManager.conf\n[main]\nplugins=ifupdown,keyfile\n\n[ifupdown]\nmanaged=false\n\n[device]\nwifi.scan-rand-mac-address=no\n
Run Code Online (Sandbox Code Playgroud)\n
\xe2\x9d\xaf cat /etc/resolv.conf                       \n# This file is managed by man:systemd-resolved(8). Do not edit.\n#\n# This is a dynamic resolv.conf file for connecting local clients to the\n# internal DNS stub resolver of systemd-resolved. This file lists all\n# configured search domains.\n#\n# Run "resolvectl status" to see details about the uplink DNS servers\n# currently in use.\n#\n# Third party programs must not access this file directly, but only through the\n# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,\n# replace this symlink by a static file or a different symlink.\n#\n# See man:systemd-resolved.service(8) for details about the supported modes of\n# operation for /etc/resolv.conf.\n\nnameserver 127.0.0.53\noptions edns0 trust-ad\n
Run Code Online (Sandbox Code Playgroud)\n

我希望有人能够发现问题所在。我还尝试过手动设置 DHCP、网络掩码和网关。

\n

更新1

\n

我刚刚尝试过

\n
\xe2\x9d\xaf sudo ifconfig enp6s0 down  \n\xe2\x9d\xaf sudo ifconfig enp6s0 up\n\xe2\x9d\xaf sudo /etc/init.d/network-manager restart\n
Run Code Online (Sandbox Code Playgroud)\n

部分修复了以太网。现在我的电缆实际上连接到了我的路由器(连接到桥接路由器),但互联网无法正常工作。但是,如果我手动将 DNS 名称服务器更改8.8.8.8

\n
\xe2\x9d\xaf sudo nano /etc/resolv.conf\n
Run Code Online (Sandbox Code Playgroud)\n

然后就可以了。resolv.conf我意识到各州的第一行

\n
This file is managed by man:systemd-resolved(8). Do not edit.\n
Run Code Online (Sandbox Code Playgroud)\n

那么我实际上应该如何做呢?还; 我敢打赌,如果我重新启动,以太网将无法工作,但也许有人知道现在如何使其工作?

\n

更新2

\n

我已将 DNS 设置为 8.8.8.8,效果很好。但重新启动后,它仍然显示电缆已拔出,我通过手动解决

\n
sudo ifconfig enp6s0 down && sudo ifconfig enp6s0 up\n
Run Code Online (Sandbox Code Playgroud)\n

我尝试添加auto enp6s0/etc/network/interfaces不起作用。供参考; /etc/network/interfaces以前不存在

\n

小智 1

您是否尝试过在 /etc/profile 中添加 sudo ifconfig enp6s0 down && sudo ifconfig enp6s0 up 作为临时解决方案。


小智 0

下次重新启动时,您所做的更改/etc/resolv.conf将被替换,但这很容易修复:

首先,得到resolvconf

sudo apt install resolvconf
Run Code Online (Sandbox Code Playgroud)

编辑/etc/resolvconf/resolv.conf.d/head文件,添加:

nameserver 8.8.4.4
nameserver 8.8.8.8
Run Code Online (Sandbox Code Playgroud)

然后重新启动resolvconf

sudo service resolvconf restart
Run Code Online (Sandbox Code Playgroud)

至于以太网接口,我之前在启动期间遇到过竞争情况时见过一次。将其添加到/etc/network/interfaces

auto enp6s0
Run Code Online (Sandbox Code Playgroud)

这应该可以解决问题。