我们有一台小型 NAS 服务器,在硬件(即不是 VM)上运行 Ubuntu 20.04.2,昨天早上网络突然以一种奇怪的方式断线了。我已经尝试自己修复了一天多,但没有取得太大进展。我们没有对系统配置或网络进行任何更改,但我们确实应用了自动更新和补丁,并且我们确实重启了一些其他设备,所以我不确定是什么导致了问题的开始。
Netplan 配置(之前运行正常)将两个以太网接口绑定在一起,并在绑定上运行两个不同的 VLAN 连接: 网络计划配置
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
enp4s0:
dhcp4: no
enp3s0:
dhcp4: no
bonds:
bond0:
dhcp4: no
interfaces:
- enp3s0
- enp4s0
parameters:
mode: balance-alb
vlans:
vlan10:
id: 10
link: bond0
dhcp4: yes
nameservers:
search: [xyz.com]
vlan20:
id: 20
link: bond0
dhcp4: yes
nameservers:
search: [xyz.com]
在启动时,两个以太网接口处于“关闭”或“DOWN”状态,并且没有 bond0 或 VLAN 的迹象: 初始启动网络结果
我发现这些日志引用了与 netplan 相关的段错误。它们似乎可能相关,但我不知道如何处理它们: NetplanSegfaultLog
ip link set enp3s0 up
我可以使用和手动启动两个以太网接口,ip link set enp4s0 up
但即使这样做了,重新应用 netplan 也没有任何效果 -bond0
和 VLAN 仍然没有出现。手动将接口设置为后,up
我可以调用dhclient
并使用 DHCP 获得基本网络连接,但它在错误的(默认)VLAN 上。我还尝试更改 Netplan 配置以将 VLAN 直接分层到以太网设备上,但这也不起作用。
手动提升后
我尝试重新安装内核(使用apt install --reinstall linux-image-generic
),也尝试重新引导到机器上仍然存在的先前的内核;但都没有产生任何变化。我已确保所有软件包都已更新。
以下是硬件信息:
---:~$ sudo lshw -c network
*-network
description: Ethernet interface
product: 82574L Gigabit Network Connection
vendor: Intel Corporation
physical id: 0
bus info: pci@0000:03:00.0
logical name: enp3s0
version: 00
serial: b0:c7:45:9f:2d:9d
size: 1Gbit/s
capacity: 1Gbit/s
width: 32 bits
clock: 33MHz
capabilities: pm msi pciexpress msix bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=e1000e driverversion=3.2.6-k duplex=full firmware=2.1-3 ip=10.0.0.2 latency=0 link=yes multicast=yes port=twisted pair speed=1Gbit/s
resources: irq:16 memory:fe900000-fe91ffff ioport:e000(size=32) memory:fe920000-fe923fff
*-network
description: Ethernet interface
product: 82574L Gigabit Network Connection
vendor: Intel Corporation
physical id: 0
bus info: pci@0000:04:00.0
logical name: enp4s0
version: 00
serial: b0:c7:45:9f:2d:9c
size: 1Gbit/s
capacity: 1Gbit/s
width: 32 bits
clock: 33MHz
capabilities: pm msi pciexpress msix bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=e1000e driverversion=3.2.6-k duplex=full firmware=2.1-3 ip=10.0.0.13 latency=0 link=yes multicast=yes port=twisted pair speed=1Gbit/s
resources: irq:17 memory:fe800000-fe81ffff ioport:d000(size=32) memory:fe820000-fe823fff
---:~$ sudo lspci
00:00.0 Host bridge: Intel Corporation Atom Processor D2xxx/N2xxx DRAM Controller (rev 04)
00:02.0 VGA compatible controller: Intel Corporation Atom Processor D2xxx/N2xxx Integrated Graphics Controller (rev 0b)
00:1a.0 USB controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #4
00:1a.1 USB controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #5
00:1a.2 USB controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #6
00:1a.7 USB controller: Intel Corporation 82801JI (ICH10 Family) USB2 EHCI Controller #2
00:1c.0 PCI bridge: Intel Corporation 82801JI (ICH10 Family) PCI Express Root Port 1
00:1c.3 PCI bridge: Intel Corporation 82801JI (ICH10 Family) PCI Express Root Port 4
00:1c.4 PCI bridge: Intel Corporation 82801JI (ICH10 Family) PCI Express Root Port 5
00:1c.5 PCI bridge: Intel Corporation 82801JI (ICH10 Family) PCI Express Root Port 6
00:1d.0 USB controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #1
00:1d.1 USB controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #2
00:1d.2 USB controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #3
00:1d.7 USB controller: Intel Corporation 82801JI (ICH10 Family) USB2 EHCI Controller #1
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev 90)
00:1f.0 ISA bridge: Intel Corporation 82801JIR (ICH10R) LPC Interface Controller
00:1f.2 SATA controller: Intel Corporation 82801JI (ICH10 Family) SATA AHCI Controller
00:1f.3 SMBus: Intel Corporation 82801JI (ICH10 Family) SMBus Controller
02:00.0 USB controller: Renesas Technology Corp. uPD720201 USB 3.0 Host Controller (rev 03)
03:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection
04:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection
提前感谢花时间阅读或提出建议的任何人!
更新:
根据@heynnema 的要求,dpkg
Netplan 的信息如下:
---:~$ sudo dpkg -l *netplan
[sudo] password for ---:
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-============-============-=================================
un netplan <none> <none> (no description available)
我真的不明白这是什么意思,但它确实提醒了我,作为一个故障排除步骤,我之前也尝试过重新安装 Netplan,既可以通过apt get install --reinstall netplan.io
,也可以通过直接下载 .deb 使用wget
然后dpkg
安装。由于上面没有提到版本,我运行了这个,你可以看到版本:
---:~$ sudo apt install netplan.io
Reading package lists... Done
Building dependency tree
Reading state information... Done
netplan.io is already the newest version (0.101-0ubuntu3~20.04.2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
更新2
以下为更正后的内容dpkg -l *netplan*
。
---:~$ sudo dpkg -l *netplan*
dpkg-query: no packages found matching netplan.io_0.101-0ubuntu3~20.04.2_amd64.deb
更新3 参见下文,我们找到了解决方案,但 Netplan.io 和 Libnetplan 版本 .101 似乎存在问题。根据答案中的建议,我手动启动了网络接口并获取了 DHCP 地址,以便访问互联网。然后我运行了此命令:
wget http://archive.ubuntu.com/ubuntu/pool/main/n/netplan.io/netplan.io_0.102-0ubuntu1~20.04.1_amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/main/n/netplan.io/libnetplan0_0.102-0ubuntu1~20.04.1_amd64.deb
sudo dpkg -i libnetplan0_0.102-0ubuntu1~20.04.1_amd64.deb
sudo dpkg -i netplan.io_0.102-0ubuntu1~20.04.1_amd64.deb
sudo netplan --debug apply
它立即解决了我的问题。我可以通过输出发现 Netplan 有所不同--debug
;在之前的尝试中,它输出了大约十几行并提到了我所有的接口,但这次它输出了更多的输出,包括解析完整的 .yaml 文件。
答案1
我的两个网络托管服务器上也遇到了同样的问题。dhcp4 网络配置正常。生成配置时出现段错误等。netplan.io 0.101 更新有些奇怪。通过手动安装提议中的 0.102 更新解决了这个问题。 https://www.ubuntuupdates.org/package/core/focal/main/proposed/netplan.io https://www.ubuntuupdates.org/package/core/focal/main/proposed/libnetplan0 我使用 dhclient 启动网络,下载了 libnetplan0 和 netplan.io,并通过 dpkg 安装了它。之后 netplan try / netplan apply 就可以正常工作了