以太网连接失败:“无 IP 配置”

以太网连接失败:“无 IP 配置”

经过几个小时的故障排除,我终于能够双启动最新版本的 Kubuntu (21.04) 和 Windows。全新安装,没有任何更改、篡改等。但是,没有互联网。它尝试连接一段时间,但随后失败,并显示错误“无可用的 IP 配置”。在按照教程操作后,我真的不明白发生了什么,我发现 ifap 甚至没有安装。我最好的猜测是缺少一些 Linux 内核头文件,正如一位遇到完全相同问题的人所说。我不知道要安装哪些头文件,甚至不知道如何安装。我检查了一下,我仍然有网络文件夹,里面有一些文件,但接口文件本身丢失了。据我所知,我也有 netplan,因为 18.04 及更高版本使用它。无论如何,我缺少一些接口,我不知道该怎么办。

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:07:00.0
       logical name: enp7s0
       version: 0c
       serial: e0:d5:5e:6a:e9:11
       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-25-generic duplex=full firmware=rtl8168g-2_0.0.1 02/06/13 ip=192.168.1.194 latency=0 link=yes multicast=yes port=twisted pair speed=100Mbit/s
       resources: irq:18 ioport:d000(size=256) memory:f7100000-f7100fff memory:f2200000-f2203fff

cat /etc/netplan/*.yaml输出:

# Let NetworkManager manage all devices on this system
network:
  version: 2
  renderer: NetworkManager

dkms status什么也没显示。

答案1

Ubuntu 20.xx 中某些以太网卡启用了 MSI/MSIX 中断。这可能会导致以太网运行不顺畅。这里有一个补丁可以修复它。按照嵌入的说明进行安装。

#!/bin/sh

# https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1779817
#
# Attached is a work-around for the in-kernel driver that is as unhacky as I can make it.

# 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.) 

# 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..

# Still hoping we can cherry pick the in-driver workaround for bionic...?

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

相关内容