Networking

如何使用 Systemd-Networkd 配置介面別名?

  • August 6, 2020

我正在嘗試將以下別名從移植/etc/network/interfaces/etc/systemd/network/eth0.network.

auto eth0:1
iface eth0:1 inet static
   address 10.0.2.1/24

正如邁克爾指出的那樣,你沒有。

相反,您向界面添加額外的Address=Gateway=行。

例子:

$ cat /etc/systemd/network/eth0.network
[Match]
Name=eth0

[Network]
Address=2a0a:3840:1337:126::b9c1:7ecb:1337/64
Gateway=2a0a:3840:1337:126::1
IPv6AcceptRA=no

Address=185.193.126.203/24
Gateway=185.193.126.1

DNS=95.215.19.53

[DHCP]
UseDNS=false

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