1. Create file /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
:
sudo nano /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
with content:
network: {config: disabled}
Press CTRL+O and Enter to save, CTRL+X to leave nano
2. Edit file /etc/netplan/50-cloud-init.yaml
:
sudo nano /etc/netplan/50-cloud-init.yaml
In addresses:
section add your new IP with /32
at end. Example files edits at end of this post.
3. Test your new config:
sudo netplan try
It will count down from 120 seconds:
– open second SSH connection to server, to make sure that network still works
– ping new additional IP, server should return ping
If SSH and ping works, press Enter to stop countdown and then run:
sudo netplan apply
If connection to SSH is blocked or ping does not work, wait these 120 seconds, so it will revert your network changes. If you accept invalid network config, it may disable network on your dedic/VPS. Then you will have to reinstall operating system on machine or run Rescue Mode in OVH panel, but it may take around 30 minutes to fix server network config – OS reinstall is faster.
Example 1
Before:
network:
version: 2
ethernets:
enp6s0:
accept-ra: false
addresses:
- 2001:aa:aa:aa::/56
dhcp4: true
match:
macaddress: aa:aa:aa:00:d9:a0
routes:
(... many lines with IPv6 config)
After:
network:
version: 2
ethernets:
enp6s0:
accept-ra: false
addresses:
- 2001:aa:aa:aa::/56
- 5.12.13.123/32
dhcp4: true
match:
macaddress: aa:aa:aa:00:d9:a0
routes:
(... many lines with IPv6 config)
Example 2
Before:
network:
version: 2
ethernets:
eno1:
match:
macaddress: "a4:bf:01:22:90:c6"
addresses:
- "2604:aa:aa:aa::1/128"
dhcp4: true
accept-ra: false
set-name: "eno1"
routes:
- on-link: true
to: "default"
via: "2604:aa:aa:aa:9ff:ff:ff:ff:ff"
After:
network:
version: 2
ethernets:
eno1:
match:
macaddress: "a4:bf:01:22:90:c6"
addresses:
- "2604:aa:aa:aa::1/128"
- 5.12.13.123/32
dhcp4: true
accept-ra: false
set-name: "eno1"
routes:
- on-link: true
to: "default"
via: "2604:aa:aa:aa:9ff:ff:ff:ff:ff"