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:
Image
IPv4 & IPv6 Dual Stack
IPv6 Single Stack
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.
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.conf configuration file.
sudovi/etc/rc.conf
Press i to enter edit mode. Add or update the following lines to enable IPv6 on your network interface.
ipv6_activate_all_interfaces="YES"
Press Esc to exit edit mode. Type :wq and press Enter to save and exit.
Run the following command to restart your network and apply the configuration.
/etc/netstartrestart
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.
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.conf for single IPv6 address.
Add the following lines to manually set a single IPv6 address and default route.
The network configuration is typically managed by Netplan.
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.
sudovi/etc/netplan/01-netcfg.yaml
Add or modify the configuration. Here is an example.
Press Esc to exit edit mode. Type :wq and press Enter to save and exit.
Restart NetworkManager to apply the IPv6 configuration.
sudosystemctlrestartNetworkManager
Alpine 3.19.1
Use the dhcpcd package to configure DHCPv6.
Install the dhcpcd package, which is a DHCP client daemon.
apkadddhcpcd
Enable dhcpcd to start at boot and then start the service.
rc-updateadddhcpcddefaultrc-servicedhcpcdstart
Reboot the system to apply the configuration changes.
sudo reboot
ArchLinux
Configure DHCPv6
By default, cloud-init generates a DHCP configuration file located at /etc/systemd/network/10-cloud-init-eth0.network. Open this file to verify the configuration.
sudo vi /etc/systemd/network/10-cloud-init-eth0.network
Make sure the following lines are present under the [Network] section.
[Match]
Name=eth0
[Network]
DHCP=yes
Press Esc to exit edit mode. Type :wq and press Enter to save and exit.
Restart the systemd-networkd service to apply the configuration.
sudo systemctl restart systemd-networkd
Configure an IPv6 Address
Run the following command to create or edit /etc/systemd/network file.
sudo vi /etc/systemd/network/10-static-eth0.network
Add the following lines to the file. Replace eth0 with your actual network interface name and use your specific IPv6 address, prefix length, and gateway.
Press Esc to exit edit mode. Type :wq and press Enter to save and exit.
Restart the systemd-networkd service to apply the static IPv6 configuration.
sudo systemctl restart systemd-networkd
AlmaLinux 9.3
Configure DHCPv6
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
Press i to enter insert mode, and add the following configuration.
IPV6INIT=yes
DHCPV6C=yes
Press Esc to exit edit mode. Type :wq and press Enter to save and exit.
Restart the instance to apply the configuration changes.
sudo reboot
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/net file.
sudo vi /etc/conf.d/net
Add configuration for DHCP.
config_eth0="dhcp"
Manual Configure an IPv6 Address
Run the following command to create or edit /etc/conf.d/net file.
sudo vi /etc/conf.d/net
Add Configuration for IPv6. Replace with your actual network values.
config_eth0="2001:db8::1/64"
routes_eth0="default via 2001:db8::ff"
dns_servers_eth0="2001:4860:4860::8888 2001:4860:4860::8844"