Configure an IPv6 Address
Background Information
After assigning the primary IPv6 address, regardless of private or public IPv6, to your elastic compute instance, for some instances with certain images, you need to access the instance and configure the IPv6 to make it effective.
IPv4 & IPv6 Dual Stack
You need manually configure the IPv6 address after assigning the primary IPv6 address for the following images:
Windows
FreeBSD 14
Gentoo openrc
IPv6 Single Stack
IPv6 addresses are not supported for the following images:
Windows
FreeBSD 14
Gentoo openrc
If you allocate additional IPv6 addresses to your instances, you also need to configure them on instances. The rules are concluded as follows:
Ubuntu 20.04
Ubuntu 22.04
Ubuntu 24.04
Debian 12
Debian 11
Debian 10
Debian 9
openSUSE lead 15.6
Rocky base 9.3
CentOS 9
Fedora base 39 1.5
Alpine 3.19.1
ArchLinux
AlmaLinux 9.3
Primary IPv6 Effective by default. No manual configuration is required.
Additional IPv6 Manual configuration is required.
Primary IPv6 Effective by default. No manual configuration is required.
Additional IPv6 Manual configuration is required.
Windows
FreeBSD 14
Gentoo openrc
Primary IPv6 Manual configuration is required.
Additional IPv6 Manual configuration is required.
IPv6 addresses are not supported.
Prerequisites
Before configuring the IPv6 address, ensure the IPv6 service is enabled. Currently, you need to enable IPv6 service on the instance with FreeBSD 14 image.
See Enable IPv6 Service for detailed steps.
Procedures
Enable IPv6 Service
You can enable IPv6 service on the instance with FreeBSD 14 image as follows:
Configure your network interface to use IPv6. Run the following command to modify the
/etc/rc.confconfiguration file.Press
ito enter edit mode. Add or update the following lines to enable IPv6 on your network interface.Press
Escto exit edit mode. Type:wqand pressEnterto save and exit.Run the following command to restart your network and apply the configuration.
Configure IPv6 Addresses
Configure the IPv6 addresses on your instances with the following images.
Debian 9, Debian 10, Debian 11
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.
Execute the following command to open the configuration file of network interface.
Configure the following information, save and exit.
Execute the following command to open the configuration file of network interface.
For Debian 10 and Debian 11, append the following information at the end.
After modification, save and exit.
For Debian 9, append the following information at the end.
After modification, save and exit.
Run the following command to reboot your instance.
openSUSE lead 15.6
Configure DHCPv6
Open the network configuration file for your network interface (e.g.,
eth0).Update the file with the following settings to enable DHCP for IPv6.
Reboot the system to apply the changes.
Manually Configure an IPv6 Address
Add the IPv6 address. Replace
2001:2:0:d38e:0:2::2with your actual IPv6 address.Add the default IPv6 route. Replace
2001:2:0:d38e::1with your actual IPv6 gateway.
Make the IPv6 Address Configuration Persistent
Open the network configuration file for your network interface (e.g.,
eth0).Modify the file to include both static IPv4 and IPv6 addresses.
Open the routes configuration file.
Add the default IPv4 and IPv6 routes.
FreeBSD 14
Note
Enable IPv6 service first before configuration.
Preliminary Steps
Run the following command to open the network configuration file.
Add the following lines to enable IPv6 address control and network interfaces.
Method 1: Configure DHCPv6
Add the following lines to accept IPv6 router advertisements and specify the DHCP client.
Install the
dual-dhclientpackage to handle DHCPv6.Example configuration.
Your
/etc/rc.confshould look something like this.Reboot the system to apply the changes.
Method 2: Manual Configure an IPv6 Address
Replace the placeholders <your_ipv6_address_1>, <your_ipv6_address_2>, <subnet_prefix_length>, and <subnet_gateway_ip> with your actual network values.
Modify
/etc/rc.conffor single IPv6 address.Add the following lines to manually set a single IPv6 address and default route.
Modify
/etc/rc.conffor multiple IPv6 addresses.Add the following lines to manually set multiple IPv6 addresses and default route.
Example configuration.
Your
/etc/rc.confshould look something like this.Reboot the system to apply the changes.
Ubuntu 20.04, Ubuntu 22.04, Ubuntu 24.04
The network configuration is typically managed by Netplan.
Netplan configuration files are located in
/etc/netplan/. The file might be named something like01-netcfg.yamlor50-cloud-init.yaml. Run the following command to open the Netplan configuration file.Add or modify the configuration. Here is an example.
Apply the Netplan configuration with the following command.
Debian 12
The network configuration is typically managed through the /etc/network/interfaces file or through NetworkManager.
Edit the Configuration File
Run the following command to open the network configuration file.
Add or modify the configuration. Here is an example.
Restart the networking service to apply the changes.
Use NetworkManager
You can use nmcli or the graphical NetworkManager tool to configure the network settings.
Here is an example for nmcli.
Rocky base 9.3
Configure DHCPv6
Run the following command to open the network interface configuration file. Replace
eth0with your actual network interface value.Press
ito enter insert mode, and add the following configuration.Press
Escto exit edit mode. Type:wqand pressEnterto save and exit.Restart the instance to apply the configuration changes.
CentOS 9
Configure DHCPv6
Run the following command to open the network interface configuration file. Replace
eth0with your actual network interface value.Press
ito enter insert mode, and add the following configuration.Press
Escto exit edit mode. Type:wqand pressEnterto save and exit.Restart the instance to apply the configuration changes.
Fedora base 39 1.5
Modify the NetworkManager connection profile to configure IPv6 addresses.
Configure DHCPv6
Run the following command to open the
cloud-init-eth0.nmconnectionfile. Replaceeth0with your actual network interface identifier if necessary.Make sure the following settings are present under the
[ipv6]section.Press
Escto exit edit mode. Type:wqand pressEnterto save and exit.Restart NetworkManager to apply the changes.
Manually Configure an IPv6 Address
Run the following command to open the
cloud-init-eth0.nmconnectionfile. Replaceeth0with your actual network interface value.Modify the
[ipv6]section. Replaceeth0with your actual network interface name and use your specific IPv6 address, prefix length, and gateway.Press
Escto exit edit mode. Type:wqand pressEnterto save and exit.Restart NetworkManager to apply the IPv6 configuration.
Alpine 3.19.1
Use the dhcpcd package to configure DHCPv6.
Install the
dhcpcdpackage, which is a DHCP client daemon.Enable
dhcpcdto start at boot and then start the service.Reboot the system to apply the configuration changes.
ArchLinux
Configure DHCPv6
By default,
cloud-initgenerates a DHCP configuration file located at/etc/systemd/network/10-cloud-init-eth0.network. Open this file to verify the configuration.Make sure the following lines are present under the
[Network]section.Press
Escto exit edit mode. Type:wqand pressEnterto save and exit.Restart the systemd-networkd service to apply the configuration.
Configure an IPv6 Address
Run the following command to create or edit
/etc/systemd/networkfile.Add the following lines to the file. Replace
eth0with your actual network interface name and use your specific IPv6 address, prefix length, and gateway.Press
Escto exit edit mode. Type:wqand pressEnterto save and exit.Restart the systemd-networkd service to apply the static IPv6 configuration.
AlmaLinux 9.3
Configure DHCPv6
Run the following command to open the network interface configuration file. Replace
eth0with your actual network interface value.Press
ito enter insert mode, and add the following configuration.Press
Escto exit edit mode. Type:wqand pressEnterto save and exit.Restart the instance to apply the configuration changes.
Gentoo openrc
Gentoo openrc supports DHCPv6 by default through configuration files located in /etc/init.d/net.*. You can manually create the /etc/conf.d/net file to configure IPv6 addresses.
Configure DHCPv6
Run the following command to create or edit
/etc/conf.d/netfile.Add configuration for DHCP.
Manual Configure an IPv6 Address
Run the following command to create or edit
/etc/conf.d/netfile.Add Configuration for IPv6. Replace with your actual network values.
Restart the network service.
Last updated