Primary IP Configuration

Last change on 2023-12-28 • Created on 2022-06-28 • ID: CL-470EB

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)

  1. Access the server via SSH

  2. Open the configuration file with an editor

    nano /etc/netplan/50-cloud-init.yaml
  3. 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
  4. 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 (Ubuntu 18.04, Debian)

  1. Access the server via SSH

  2. Open the configuration file with an editor

    nano /etc/network/interfaces.d/50-cloud-init
  3. 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
  4. Change/assign your Primary IPv6

    Now that the configuration file has been changed, you can safely assign the new Primary IPv6 to your server.


RHEL-based distributions (CentOS, Fedora, Rocky)

  1. Access the server via SSH

  2. 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
  3. Change/assign your Primary IPv6

    Now that the configuration file has been changed, you can safely assign the new Primary IPv6 to your server.

Table of Contents