On an Ubuntu 20.04 server, netplan is used to configure the network. It can configure ordinary static IP addresses but I need additional IPv6 addresses with preferred_lft=0. Netplan can't do that (there's an open bug for that). So I found out that it actually goes like this:
- Netplan reads its own limited config and transforms it into a config for the more powerful systemd-network.
- systemd-network probably passes on its data to things like the
ipcommand when a network device appears.
- The network device then applies the actual configuration. Down here everything is possible.
If netplan can't help me, I tried to move on to systemd. Since I don't want to remove the apparently widely used and highly praised netplan entirely, I just need to add my additional addresses besides the basic netplan config.
I tried to create the file /etc/systemd/network/web-ipv6.conf with this content:
[Match] Name=ens33 (this is the name from the existing netplan file) [Address] Address=fd9e:21a7:a92c:2323::2/64 PreferredLifetime=0
The address fd9e:21a7:a92c:2323::1 is configured statically via netplan. In this demo it's a local address, in reality it's my server's main IPv6 address. Additional addresses have a different interface value, like this ...::2.
I guess I have to apply my config with
systemctl restart systemd-networkd but I'm not sure. The log says things I'd consider a success. But the new IPv6 address ...::2 doesn't show up in
In the man page for systemd.network I've read that only a single file for a
[Match] will be used. I clearly have two files now: one from netplan (/run/systemd/network/10-netplan-ens33.network) and my other one. So this doesn't seem to work. But I don't want to edit netplan's file as it will surely be overwritten sometime.
How should I continue with this? I'd like to have a separate and persistent file that only adds my additional addresses. I'm going to manage that file in a custom script.
Should I go back to
ifupdown or what it was in the old days? In a previous server setup I use a file named /etc/network/if-up.d/dynamic6 that contains all the
ip addr add ... dev ... preferred_lft 0 commands. From what I've seen this is today considered deprecated.