My server has a file /etc/netplan/50-cloud-init.yaml with the following content:
# This file is generated from information provided by
# the datasource. Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
version: 2
ethernets:
ens3:
dhcp4: true
match:
macaddress: fa:**:**:**:**:**
set-name: ens3
This results in the following interface configuration:
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc fq_codel state UP group default qlen 1000
link/ether fa:**:**:**:**:** brd ff:ff:ff:ff:ff:ff
inet 10.0.0.5/24 brd 10.0.0.255 scope global dynamic ens3
...
So far, so good. But now I need to add 10.0.0.250 as an additional secondary static IP to this interface. What is the best way to do that? I created a new file /etc/netplan/60-service-ip.yaml with:
network:
version: 2
ethernets:
ens3:
addresses:
- 10.0.0.5/24
- 10.0.0.250/24
This seems to work, but it re-defines a dynamic IP as a static one.