![Ubuntu 20.04 中以太网不工作](https://linux22.com/image/940311/Ubuntu%2020.04%20%E4%B8%AD%E4%BB%A5%E5%A4%AA%E7%BD%91%E4%B8%8D%E5%B7%A5%E4%BD%9C.png)
我是 Linux 的新手。我尝试在 Ubuntu 20.04 上运行以太网,但没有运行,什么也没得到,甚至有线非托管也没有。以太网在 Windows 10 上运行良好。
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:05:00.0
logical name: enp5s0
version: 15
serial: 2c:f0:5d:66:42:09
size: 1Gbit/s
capacity: 1Gbit/s
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress msix 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-27-generic duplex=full firmware=rtl8168h-2_0.0.2 02/26/15 latency=0 link=yes multicast=yes port=twisted pair speed=1Gbit/s
resources: irq:45 ioport:f000(size=256) memory:fe904000-fe904fff memory:fe900000-fe903fff
它之前被禁用了,但是在按照这个之后解决方案,它显示有线未托管。我尝试了其他各种解决方案。到目前为止,没有一个对我有用。有些解决方案特定于 Ubuntu 18.04 或更早版本。
答案1
修复后,您可能会发现以太网要么间歇性出现故障,要么仅在启动 Windows 后才能工作。
Ubuntu 20.xx 中某些以太网卡启用了 MSI/MSIX 中断。这可能会导致以太网运行不顺畅。这里有一个补丁可以修复它。按照嵌入的说明进行安装。
#!/bin/sh
# https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1779817
# filename: r8169_disable_msi
# Drop it in /etc/initramfs-tools/scripts/init-top and chmod a+x it. Add 'r8169_disable_msi'
# to your kernel command line (/etc/default/grub, GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
# usually.)
# sudo -H gedit /etc/default/grub # to edit the file
# Remember to update-initramfs and update-grub as necessary.
# sudo update-initramfs -c -k $(uname -r)
# sudo update-grub
# reboot
# For the moment it disables MSI on everything with the ID 0x10ec:0x8168, as there seems to
# be no way to get the MAC version from userspace - and certainly not before the driver is
# loaded. Other PCI IDs may need adding..
PREREQ=""
prereqs()
{
echo "$PREREQ"
}
case $1 in
# get pre-requisites
prereqs)
prereqs
exit 0
;;
esac
disable_msi () {
for i in /sys/bus/pci/devices/*; do
if [ $(cat $i/vendor) = "0x10ec" -a $(cat $i/device) = "0x8168" ]; then
echo 0 >$i/msi_bus
fi
done
}
for x in $(cat /proc/cmdline); do
case ${x} in
r8169_disable_msi)
disable_msi
break
;;
esac
done