Configure an IPv6 Address

Background Information

After assigning the public IPv6 address to your virtual machine instance at creation, the IPv6 will be effective by default. No manual configuration is required. If you allocate additional IPv6 addresses to your instances, you need to access the instance and configure the IPv6 to make it effective.

IPv6 Address Configuration

Configure the IPv6 addresses on your instances with the following images.

Debian 7

The assigned IPv6 address will take effect automatically but may be invalid after an instance reboot. Therefore, cloud-init's ability to modify network interface files in the /etc/network/interfaces.d directory must be disabled.

In the following example, default network interface configuration file is: /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg.

  1. Execute the following command to open the configuration file of network interface.

    sudo vi /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
  2. Configure the following information, save and exit.

    network: {config: disabled}
  3. Execute the following command to open the configuration file of network interface.

    sudo vi /etc/network/interfaces.d/50-cloud-init
  4. Append the following information at the end.

    iface eth0 inet6 dhcp

    After modification, save and exit.

  5. Run the following command to reboot your instance.

    sudo reboot
Ubuntu 24.04

The network configuration is typically managed by Netplan.

  1. Netplan configuration files are located in /etc/netplan/. The file might be named something like 01-netcfg.yaml or 50-cloud-init.yaml. Run the following command to open the Netplan configuration file.

    sudo vi /etc/netplan/01-netcfg.yaml
  2. Add or modify the configuration. Here is an example.

    network:
      version: 2
      ethernets:
        eth0:
          dhcp4: no
          dhcp6: no
          addresses:
            - 2001:db8::1/64
            - 2001:db8::2/64
          gateway6: 2001:db8::ff
          nameservers:
            addresses:
              - 2001:4860:4860::8888
              - 2001:4860:4860::8844
  3. Apply the Netplan configuration with the following command.

    sudo netplan apply
CentOS 9

Configure DHCPv6

  1. Run the following command to open the network interface configuration file. Replace eth0 with your actual network interface value.

    sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0
  2. Press i to enter insert mode, and add the following configuration.

    IPV6INIT=yes
    DHCPV6C=yes
  3. Press Esc to exit edit mode. Type :wq and press Enter to save and exit.

  4. Restart the instance to apply the configuration changes.

    sudo reboot

Last updated