Primary IPs of either type (IPv4, IPv6) that are assigned to a cloud server at the server's creation, do not require a manual configuration.
Changing the Primary IPs of an existing cloud server, requires the following:
- Changing/assigning the Primary IPv4 does not require any manual configurations.
- Changing/assigning the Primary IPv6 does require a basic manual configuration.
The following examples explain how to edit the server's network configuration file for the new IPv6 address.
On servers that only have an IPv6 after the changes were applied, you will have to edit the configuration file before the new Primary IPv6 is assigned to the server.
If you don't edit the configuration file before the new Primary IPv6 is assigned, you will have to use the console on the Cloud Console or the Rescue System to edit the IPv6 on the server. Once the changes are made, you will be able to connect to your server as before.
Ubuntu using netplan (20.04 or later)
-
Access the server via SSH
-
Open the configuration file with an editor
nano /etc/netplan/50-cloud-init.yaml
-
Edit the configuration file
Go to
addresses
and add your public IPv6. In the example below, you would have to replace 2001:db8:1234::1 with your own Primary IPv6. No other changes are needed in your original configuration file. Do not change any other settings, such as your own MAC address.# This file is generated from information provided by the datasource. Changes # to it will not persist across an instance reboot. 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: eth0: addresses: - <one IPv6 address from your subnet, e.g. 2001:db8:0:3df1::1>/64 dhcp4: true routes: - to: default via: fe80::1 match: macaddress: your-original-macaddress nameservers: addresses: - 2a01:4ff:ff00::add:2 - 2a01:4ff:ff00::add:1 set-name: eth0
-
Change/assign your Primary IPv6
Now that the configuration file has been changed, you can safely assign the new Primary IPv6 to your server.
Debian-based distributions using ifupdown
-
Access the server via SSH
-
Open the configuration file with an editor
nano /etc/network/interfaces.d/50-cloud-init
-
Edit the configuration file
Go to the
address
line and add your public IPv6. In the example below, you would have to insert your Primary IPv6. No other changes are needed in your original configuration file.# This file is generated from information provided by the datasource. Changes # to it will not persist across an instance reboot. 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} auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp dns-nameservers 185.12.64.2 185.12.64.1 # control-alias eth0 iface eth0 inet6 static address <one IPv6 address from your subnet, e.g. 2001:db8:0:3df1::1>/64 dns-nameservers 2a01:4ff:ff00::add:1 2a01:4ff:ff00::add:2 gateway fe80::1
-
Change/assign your Primary IPv6
Now that the configuration file has been changed, you can safely assign the new Primary IPv6 to your server.
RHEL8-based distributions (Alma, Rocky)
-
Access the server via SSH
-
Open the configuration file /etc/sysconfig/network-scripts/ifcfg-eth0
BOOTPROTO=dhcp DEFROUTE=yes DEVICE=eth0 DNS1=2a01:4ff:ff00::add:1 DNS2=185.12.64.1 HWADDR=<keep the HWADDR as is!!> IPV6ADDR=<one IPv6 address from your subnet, e.g. 2001:db8:0:3df1::1>/64 IPV6INIT=yes IPV6_AUTOCONF=no IPV6_DEFAULTGW=fe80::1 IPV6_FORCE_ACCEPT_RA=no ONBOOT=yes TYPE=Ethernet USERCTL=no
-
Change/assign your Primary IPv6
Now that the configuration file has been changed, you can safely assign the new Primary IPv6 to your server.
Fedora/RHEL9-based distributions (Alma, CentOS, Rocky)
-
Access the server via SSH
-
Open the configuration file /etc/NetworkManager/system-connections/cloud-init-eth0.nmconnection
[connection] id=cloud-init eth0 uuid=<keep the UUID as is!!> type=ethernet [ethernet] mac-address=<keep the HWADDR as is!!> [ipv4] address1=<your IPv4 address>/32,172.31.1.1 dns=185.12.64.1;185.12.64.2; may-fail=false method=manual [ipv6] address1=<one IPv6 address from your subnet, e.g. 2001:db8:0:3df1::1>/64,fe80::1 dns=2a01:4ff:ff00::add:1;2a01:4ff:ff00::add:2; may-fail=false method=manual [proxy] [user] org.freedesktop.NetworkManager.origin=cloud-init
-
Change/assign your Primary IPv6
Now that the configuration file has been changed, you can safely assign the new Primary IPv6 to your server.