Ubuntu 16.04.3:无法启动提升网络接口

Ubuntu 16.04.3:无法启动提升网络接口

我有 Ubuntu 16.04.3 LTS,上面运行着 EVE-NG。我遇到了 Predictable-Network-Interface-Names 的已知问题,并将接口名称更改为旧样式,但仍然有问题。

在启动过程中,我看到“无法启动提升网络接口”消息。然后,这就是 systemctl 显示的内容:

* networking.service - Raise network interfaces
   Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled)
  Drop-In: /run/systemd/generator/networking.service.d
           `-50-insserv.conf-$network.conf
   Active: failed (Result: exit-code) since Tue 2017-11-14 07:06:04 EST; 20min ago
     Docs: man:interfaces(5)
  Process: 677 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=1/FAILURE)
  Process: 570 ExecStartPre=/bin/sh -c [ "$CONFIGURE_INTERFACES" != "no" ] && [ -n "$(ifquery --read-environment --list --exclude=lo)" ] && udevadm settle (
 Main PID: 677 (code=exited, status=1/FAILURE)

Nov 14 07:06:03 eve-ng ifup[677]: Waiting for pnet2 to get ready (MAXWAIT is 32 seconds).
Nov 14 07:06:04 eve-ng ifup[677]: SIOCADDRT: File exists
Nov 14 07:06:04 eve-ng ifup[677]: Failed to bring up pnet2.
Nov 14 07:06:04 eve-ng ifup[677]: Waiting for pnet3 to get ready (MAXWAIT is 32 seconds).
Nov 14 07:06:04 eve-ng ifup[677]: interface eth4 does not exist!
Nov 14 07:06:04 eve-ng ifup[677]: Waiting for pnet4 to get ready (MAXWAIT is 32 seconds).
Nov 14 07:06:04 eve-ng systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE
Nov 14 07:06:04 eve-ng systemd[1]: Failed to start Raise network interfaces.
Nov 14 07:06:04 eve-ng systemd[1]: networking.service: Unit entered failed state.
Nov 14 07:06:04 eve-ng systemd[1]: networking.service: Failed with result 'exit-code'

但是,我的接口已成功重命名:dmesg | grep eth 确认启动期间没有发生重命名。

所有接口均已启动并运行,我可以通过 SSH 连接到该主机。

我已经做过的事情(但都不起作用):

您禁用固定名称的分配,以便再次使用不可预测的内核名称。为此,只需屏蔽 udev 的默认策略规则文件:ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules// 完毕

您在内核命令行上传递 net.ifnames=0// 完毕

您可以创建自己的手动命名方案,例如,将接口命名为“internet0”、“dmz0”或“lan0”。为此,请在 /etc/systemd/network/ 中创建自己的 .link 文件,为一个、一些或所有接口选择一个明确的名称或更好的命名方案。// 完毕:

cat /etc/systemd/network/10-eth.link
[Match]
MACAddress=00:0c:29:20:c2:66
[Link]
Name=eth0
[Match]
MACAddress=00:0c:29:20:c2:70
[Link]
Name=eth1
[Match]
MACAddress=00:0c:29:20:c2:7a
[Link]
Name=eth2
[Match]
MACAddress=00:0c:29:20:c2:84
Name=eth3

我确实在 /etc/udev/rules.d/ 中创建了一个新文件 10-rename-network.rules,并在其中添加了以下内容:SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="ff:ff:ff:ff:ff:ff", NAME="eth0"//完毕:

cat /etc/udev/rules.d/10-rename-network.rules
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="00:0c:29:20:c2:66", NAME="eth0"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="00:0c:29:20:c2:70", NAME="eth1"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="00:0c:29:20:c2:7a", NAME="eth2"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="00:0c:29:20:c2:84", NAME="eth3"

我是否遗漏了什么?

答案1

原因

该问题是由 systemd/udev 的 Predictable-Network-Interface-Names 引起的。可能的解决方案

根据此来源,您可以:

You disable the assignment of fixed names, so that the unpredictable kernel names are used again. For this, simply mask udev's rule file for the default policy: ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules
You create your own manual naming scheme, for example by naming your interfaces "internet0", "dmz0" or "lan0". For that create your own .link files in /etc/systemd/network/, that choose an explicit name or a better naming scheme for one, some, or all of your interfaces. See systemd.link(5) for more information.
You pass the net.ifnames=0 on the kernel command line

应用解决方案

我确实在 /etc/udev/rules.d/ 中创建了一个新文件 10-rename-network.rules,并在其中添加了以下内容:

子系统=="net", 动作=="添加", 属性{地址}=="ff:ff:ff:ff:ff:ff", 名称="eth0"

在哪里

eth0 = desired network interface name, used in /etc/network/interfaces
ff:ff:ff:ff:ff:ff = hardware mac address of the network device

我建议完成此操作后重新启动以确保更改生效。

相关内容