Debian buster 中的 networking.service 失败

Debian buster 中的 networking.service 失败

networking.service 无法启动 eth0:2 和 eth0:3,但我的配置似乎正确。

我尝试了几种方法,还将网卡从 ens3 重命名为 eth0

在 /etc/网络/接口:

auto lo
iface lo inet loopback

allow-hotplug eth0

auto eth0
iface eth0 inet static
    address xx.xxx.xxx.xxx/22
    gateway xx.xxx.xxx.x

allow-hotplug eth0:1
auto eth0:1
iface eth0:1 inet6 static
    address 2a03:xxxx:x:xxxx::1000/64
    gateway fe80::1

allow-hotplug eth0:2
iface eth0:2 inet6 static
    address 2a03:xxxx:x:xxxx::2000/64
    gateway fe80::1

allow-hotplug eth0:3
iface eth0:3 inet6 static
    address 2a03:xxxx:x:xxxx::3000/64
    gateway fe80::1

预期的:

在启动时,eth0 和 eth0:1 会自动启动。

ifup eth0:2 和 ifup eth0:3 启动其他网卡

实际的:

ifup eth0:2
RTNETLINK answers: File exists
ifup: failed to bring up eth0:2

ifup eth0:3
RTNETLINK answers: File exists
ifup: failed to bring up eth0:3

它给出了一个错误,但是尽管出现错误,适配器仍然已加载并且 IPv6 正在运行。

另外,如果我添加

自动 eth0:2

自动 eth0:3

networking.service 启动时失败:


● networking.service - Raise network interfaces
   Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2019-07-19 20:29:26 CEST; 1min 21s ago
     Docs: man:interfaces(5)
  Process: 409 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=1/FAILURE)
 Main PID: 409 (code=exited, status=1/FAILURE)
Jul 19 20:29:24 root systemd[1]: Starting Raise network interfaces...
Jul 19 20:29:24 root ifup[409]: ifup: waiting for lock on /run/network/ifstate.eth0
Jul 19 20:29:26 root ifup[409]: Waiting for DAD... Done
Jul 19 20:29:26 root ifup[409]: RTNETLINK answers: File exists
Jul 19 20:29:26 root ifup[409]: ifup: failed to bring up eth0:2
Jul 19 20:29:26 root ifup[409]: RTNETLINK answers: File exists
Jul 19 20:29:26 root ifup[409]: ifup: failed to bring up eth0:3
Jul 19 20:29:26 root systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE
Jul 19 20:29:26 root systemd[1]: networking.service: Failed with result 'exit-code'.
Jul 19 20:29:26 root systemd[1]: Failed to start Raise network interfaces.

尽管 networking.service 失败,但所有 IPv6 均正常运行。

我不知道问题出在哪里。

答案1

您尝试将过时的接口别名格式 ( eth0:x) 与 IPv6 结合使用,但这样做行不通。这些实际上并不是单独的接口,也从来都不是。十多年来,人们一直建议不要使用它们。您不应该这样做。(并且您应该忽略 Debian wiki 中关于此方法的长篇过时警告。)

正确的配置是将所有地址放在接口中eth0(或者,更确切地说,ens3它不应该再这样了eth0)。

auto lo
iface lo inet loopback

allow-hotplug eth0

auto eth0
iface eth0 inet static
    address xx.xxx.xxx.xxx/22
    gateway xx.xxx.xxx.x

iface eth0 inet6 static
    address 2a03:xxxx:x:xxxx::1000/64
    gateway fe80::1

iface eth0 inet6 static
    address 2a03:xxxx:x:xxxx::2000/64

iface eth0 inet6 static
    address 2a03:xxxx:x:xxxx::3000/64

相关内容