Networking

network.service 在 Debian buster 中失敗

  • July 20, 2019

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

network.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 都在工作。

我不知道有什麼問題。

您正在嘗試將過時的介面別名格式 ( 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

引用自:https://serverfault.com/questions/976000