我的 Ubuntu 机器上有一块网卡无法启动(如链路断开、第 1 层问题)。驱动程序已加载,如下所示:
$ ethtool -i ens8
driver: r8169
version: 6.8.0-35-generic
firmware-version: rtl8168h-2_0.0.2 02/26/15
expansion-rom-version:
bus-info: 0000:00:08.0
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: yes
supports-priv-flags: no
我尝试建立该链接,但发生了以下情况:它只是保持关闭状态。
$ sudo ip link set ens8 up
$ ip a | grep -A3 ens8
3: ens8: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
link/ether 9c:53:22:48:71:63 brd ff:ff:ff:ff:ff:ff
altname enp0s8
我检查 dmesg 和内核/驱动程序警报:
$ sudo dmesg -T | grep "ens8\|r8169"
[Wed Jun 12 21:13:19 2024] r8169 0000:00:08.0 eth0: RTL8168h/8111h, 9c:53:22:48:71:63, XID 541, IRQ 29
[Wed Jun 12 21:13:19 2024] r8169 0000:00:08.0 eth0: jumbo features [frames: 9194 bytes, tx checksumming: ko]
[Wed Jun 12 21:13:19 2024] r8169 0000:00:08.0 ens8: renamed from eth0
[Wed Jun 12 21:13:22 2024] Generic FE-GE Realtek PHY r8169-0-40:00: attached PHY driver (mii_bus:phy_addr=r8169-0-40:00, irq=MAC)
[Wed Jun 12 21:13:22 2024] r8169 0000:00:08.0 ens8: No native access to PCI extended config space, falling back to CSI
[Wed Jun 12 21:13:22 2024] r8169 0000:00:08.0 ens8: Link is Down
我看到上面写着“无法本机访问 PCI 扩展配置空间”,而谷歌对此没有明确的答案。我不知道该怎么做,我正在寻求帮助来解决这个问题。
我已经在网络管理器中创建了一个基本网络配置文件,专门为 ens8 提供动态 IP,但是当我尝试激活它时,出现以下信息:
$ nmcli con up PCINIC
Error: Connection activation failed: No suitable device found for this connection (device ens3 not available because profile is not compatible with device (mismatching interface name)).
我还在下面添加了这个配置文件(为简单起见,提供了一个简短的版本)以显示我使用的设置:
$ nmcli con show PCINIC
connection.id: PCINIC
connection.type: 802-3-ethernet
connection.interface-name: ens8
connection.autoconnect: yes
connection.autoconnect-priority: 400
ipv4.method: auto
附注:这是一台使用 PCI 直通的虚拟机,用于主机中的 PCI 网卡。如果我将此 NIC 移入 Ubuntu 18.04 VM,它就可以正常工作。但是,在我使用 Ubuntu 24.04 LTS 安装新 VM 并将该 NIC 从旧 VM 移至新 VM 后,我似乎无法建立此链接。所以这不是 NIC 的故障,在我看来,这是与驱动程序相关的。
编辑:添加了一些 lspci 输出,以及手动设置速度双工:
$ lspci -knn | grep -A 5 00:08
00:08.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10ec:8161] (rev 15)
Subsystem: Realtek Semiconductor Co., Ltd. TP-Link TG-3468 v4.0 Gigabit PCI Express Network Adapter [10ec:8168]
Kernel driver in use: r8169
Kernel modules: r8169, r8168
我还尝试通过以下方式手动设置速度和双工:
$ nmcli con modify PCINIC 802-3-ethernet.auto-negotiate no 802-3-ethernet.speed 1000 802-3-ethernet.duplex full
$ sudo systemctl restart NetworkManager.service
$ nmcli con up PCINIC
Error: Connection activation failed: No suitable device found for this connection (device ens3 not available because profile is not compatible with device (mismatching interface name)).
$ ip a | grep ens8
3: ens8: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
现在将其设置回自动:
$ nmcli con modify PCINIC 802-3-ethernet.auto-negotiate yes
$ sudo systemctl restart NetworkManager.service
$ nmcli con up PCINIC
Error: Connection activation failed: No suitable device found for this connection (device ens3 not available because profile is not compatible with device (mismatching interface name)).
$ ip a | grep ens8
3: ens8: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
需要明确的是,这张卡在我仍在这台计算机上的 Ubuntu 18.04 vm 上运行良好,排除了连接到另一端的电缆和交换机。