To use IPv6 for public and private network communication in a Virtual Private Cloud (VPC), you must create an Elastic Compute Service (ECS) instance that has an IPv6 address. The instance must be in a VPC and connected to a vSwitch with IPv6 enabled. This topic describes how to assign and configure an IPv6 address for an ECS instance to enable communication over IPv6.
Note The number of available IPv4 addresses is limited. Network engineers often spend significant time and effort resolving address conflicts. In contrast, IPv6 provides a vast address space. This resolves the issue of address exhaustion and removes barriers for the large number of devices connecting to the Internet.
Limits
Regions that support IPv6 gateways
Note IPv6 Gateway is an IPv6 traffic gateway for a VPC. By default, an assigned IPv6 address can be used for private network communication only. To enable public network communication, you must enable Internet bandwidth for the IPv6 address in an IPv6 gateway. For more information, see What is an IPv6 Gateway?.
Area | Regions |
Asia Pacific - China | China (Qingdao), China (Beijing), China (Zhangjiakou), China (Hohhot), China (Ulanqab), China (Hangzhou), China (Shanghai), China (Fuzhou - Local Region), China (Shenzhen), China (Heyuan), China (Guangzhou), China (Chengdu), and China (Hong Kong) |
Asia Pacific - Others | Philippines (Manila), Singapore, Japan (Tokyo), South Korea (Seoul), Indonesia (Jakarta), Malaysia (Kuala Lumpur), and Thailand (Bangkok) |
Europe & Americas | US (Virginia), US (Silicon Valley), Germany (Frankfurt), UK (London), and Mexico |
Middle East | SAU (Riyadh - Partner Region)
Important The SAU (Riyadh - Partner Region) region is operated by a partner. |
Instance families that do not support IPv6
ic5, a compute-intensive instance family
se1, a memory-optimized instance family
d1, a big data instance family
i2g and i1, instance families with local SSDs
hfc5, a compute-optimized instance family with high clock speeds, and hfg5, a general-purpose instance family with high clock speeds
ebmg5, a general-purpose ECS Bare Metal Instance family, and ebmr5s, a network-enhanced memory-optimized ECS Bare Metal Instance family
xn4, n4, mn4, and e4, previous-generation shared instance families
scch5, a Super Computing Cluster (SCC) instance family with high clock speeds
gn5, a GPU-accelerated computed optimized instance family
n1, n2, and e3, shared instance families
sn2 and sn1, general-purpose instance families
Limit on the number of IPv6 addresses that can be assigned to an ECS instance
The maximum number of IPv6 addresses that you can assign to an ECS instance depends on two factors:
The number of IPv6 addresses that you can assign to a single Elastic Network Interface (ENI). The number is determined by the instance type. For more information, see the IPv6 addresses per ENI column in Instance families.
The number of ENIs that you can attach to an instance. The number is determined by the instance type. For more information, see the ENIs column in Instance families.
Procedure
Note You can use one-click deployment to quickly perform the following operations.
Step 1: Enable IPv6 for a VPC and a vSwitch
First, ensure that IPv6 is enabled for the VPC where your ECS instance is located and for the vSwitch to which the instance is connected. For more information, see Enable IPv6 for a VPC and Enable IPv6 for a vSwitch.


Step 2: Assign an IPv6 address
Assigning an IPv6 address to an ECS instance allows the instance to communicate with other instances or external networks over IPv6.
Assign an IPv6 address to an existing instance
Go to ECS console - Instance.
In the top navigation bar, select the region and resource group of the resource that you want to manage.
Find the target ECS instance and click the instance ID. On the instance details page, choose Actions > in the upper-right corner.

In the Manage Secondary Private IP dialog box, assign an IPv6 address as prompted.

Click OK.
Assign an IPv6 address when you create an instance
When you create an instance, configure the following parameters. For information about other parameters, see Create an instance on the Custom Launch tab.
Network And Zone: Select a VPC and a vSwitch that have IPv6 CIDR blocks assigned.
Instance: Click View More Specification Parameters. Filter for instance types that support IPv6 and select an instance type.

Bandwidth And Security Groups: Click ENI|IPv6 (Optional), and select Assign IPv6 Address Free Of Charge.

After you assign the IPv6 address, you can view the IP address details in the ECS console. For more information, see IP addresses.
Step 3: Configure an IPv6 address
You must configure the IPv6 address on the network interface card (NIC) of the ECS instance to allow the operating system to recognize and use the address.
Some images support automatic configuration and recognition of IPv6 addresses. You can perform the following steps to check whether the operating system of your ECS instance has recognized the IPv6 address.
Linux instances
Remotely connect to the Linux instance.
For more information, see Log on to a Linux instance using Workbench.
Run the ip -6 addr show
or ifconfig
command.
If the output includes a global unicast address and a link-local address as shown in the figure, the IPv6 address is recognized. You can skip the rest of this step. Otherwise, continue with the following operations.

Windows instances
Remotely connect to the Windows instance.
For more information, see Log on to a Windows instance using a Workbench remote connection (RDP).
Open the command-line tool and run the ipconfig
command.
If the output includes a global unicast address and a link-local address as shown in the figure, the IPv6 address is recognized. You can skip the rest of this step. Otherwise, continue with the following operations.

Configure the IPv6 address.
Important To automatically configure an IPv6 address, you must install Cloud Assistant Agent. If Cloud Assistant Agent is not supported by your instance or cannot be installed, you must manually configure the IPv6 address.
(Recommended) Automatically configure an IPv6 address
Prerequisites
The instance has Cloud Assistant Agent installed. If it is not installed, see Install Cloud Assistant Agent.
This method applies only to the following operating systems: Alibaba Cloud Linux 2/3, CentOS 6/7/8, Red Hat 6/7, Anolis OS, Fedora, Ubuntu 14/16/18/20, Debian 8/9/10/11, SUSE 11/12/15, OpenSUSE 15/42, and FreeBSD 11.
Important This configuration process uses Cloud Assistant. This process may automatically restart the NIC and network services, causing a brief network interruption. Proceed with caution.
Procedure
Remotely connect to the Linux instance.
For more information, see Log on to a Linux instance using Workbench.
Run the following command to configure the IPv6 address.
Note By default, when you run the following command, the command automatically checks whether the ecs-utils-ipv6
plug-in is installed and whether the installed version is the latest. If the plug-in is not installed or the installed version is not the latest, the latest version is automatically downloaded and installed.
sudo acs-plugin-manager --exec --plugin=ecs-utils-ipv6
Manually configure (Linux)
Remotely connect to the Linux instance.
For more information, see Log on to a Linux instance using Workbench.
Run the ip addr | grep inet6
or ifconfig | grep inet6
command to check whether the IPv6 service is enabled on the instance.
If the output does not contain inet6
, the IPv6 service is disabled. Enable the IPv6 service.
How to enable the IPv6 service
Alibaba Cloud Linux 2/3
Run the following command to modify the /etc/sysctl.conf
configuration file.
vi /etc/sysctl.conf
Press the i
key to enter edit mode. Find the following content and replace the value 1
with 0
.
net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1 net.ipv6.conf.lo.disable_ipv6 = 1
To enable a specific network interface, modify the information as shown in the following example.
net.ipv6.conf.eth0.disable_ipv6 = 0
After you finish, press the Esc
key to exit edit mode. Enter :wq
and press the Enter key to save and exit.
Run the following command to check whether the /etc/sysctl.conf
configuration differs from the /etc/sysctl.conf
in initramfs.
diff -u /etc/sysctl.conf <(lsinitrd -f /etc/sysctl.conf)
Note Alibaba Cloud Linux 2 is configured with an initial RAM file system (initramfs). If the /etc/sysctl.conf
file in initramfs differs from the IPv6 configuration file /etc/sysctl.conf
, the system may apply a new configuration that conflicts with your intended settings.
If the two configuration files differ, run the following command to regenerate initramfs
.
sudo dracut -v -f
Restart the ECS instance for the configuration to take effect. For more information, see Restart an instance.
Run the ip addr | grep inet6
or ifconfig | grep inet6
command to verify that IPv6 is enabled.
If the system returns content related to inet6
, the IPv6 service is enabled.
CentOS 6/7
Run the following command to modify the /etc/modprobe.d/disable_ipv6.conf
configuration file.
vi /etc/modprobe.d/disable_ipv6.conf
Press the i
key to enter edit mode and change options ipv6 disable=1
to options ipv6 disable=0
.
After you finish, press the Esc
key to exit edit mode. Enter :wq
and press the Enter key to save and exit.
Run the following command to modify the /etc/sysconfig/network
configuration file.
vi /etc/sysconfig/network
Press the i
key to enter edit mode and change NETWORKING_IPV6=no
to NETWORKING_IPV6=yes
.
After you finish, press the Esc
key to exit edit mode. Enter :wq
and press the Enter key to save and exit.
(Optional) Run the following commands in sequence to reload the IPv6 module.
Note If your operating system is CentOS 6, perform this step. Otherwise, skip this step.
modprobe ipv6 -r modprobe ipv6 lsmod | grep ipv6
If the system returns the following content, the IPv6 module is loaded.
ipv6 xxxxx 8
Note The parameter value in the third column of the output cannot be 0. If it is, you must reset the IPv6 service.
Run the following command to modify the /etc/sysctl.conf
configuration file.
vi /etc/sysctl.conf
Press the i
key to enter edit mode. Find the following content and replace the value 1
with 0
.
net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1 net.ipv6.conf.lo.disable_ipv6 = 1
After you finish, press the Esc
key to exit edit mode. Enter :wq
and press the Enter key to save and exit.
Run the following command for the configuration to take effect.
sudo sysctl -p
Debian 8/9
Run the following command to modify the /etc/default/grub
configuration file.
vi /etc/default/grub
Press the i
key to enter edit mode and delete the ipv6.disable=1
content.
After you finish, press the Esc
key to exit edit mode. Enter :wq
and press the Enter key to save and exit.
You can run the following command to modify the /boot/grub/grub.cfg
configuration file.
vi /boot/grub/grub.cfg
Press the i
key to enter edit mode and delete the ipv6.disable=1
line.
When you are finished, press the Esc
key to exit edit mode. Enter :wq
and press Enter to save your changes and exit.
Restart the Linux instance. For more information, see Restart an instance.
Run the following command to modify the /etc/sysctl.conf
configuration file.
vi /etc/sysctl.conf
Press the i
key to enter edit mode. Find the following content and replace the value 1
with 0
.
net.ipv6.conf.all.disable_ipv6 = 0 net.ipv6.conf.default.disable_ipv6 = 0 net.ipv6.conf.lo.disable_ipv6 = 0
After you finish, press the Esc
key to exit edit mode. Enter :wq
and press the Enter key to save and exit.
Run the following command for the configuration to take effect.
sudo sysctl -p
Ubuntu 14/16 and OpenSUSE 42
Run the following command to modify the vi /etc/sysctl.conf
configuration file.
vi /etc/sysctl.conf
Press the i
key to enter edit mode. Find the following content and replace the value 1
with 0
.
net.ipv6.conf.all.disable_ipv6 = 0 net.ipv6.conf.default.disable_ipv6 = 0 net.ipv6.conf.lo.disable_ipv6 = 0
After you finish, press the Esc
key to exit edit mode. Enter :wq
and press the Enter key to save and exit.
Run the following command for the configuration to take effect.
sysctl -p
FreeBSD 11
Run the following command to modify the /etc/rc.conf
configuration file.
vi /etc/rc.conf
Press the i
key to enter edit mode and add the ipv6_activate_all_interfaces="YES"
content.
After you finish, press the Esc
key to exit edit mode. Enter :wq
and press the Enter key to save and exit.
Run the following command to restart the network for the configuration to take effect.
/etc/netstart restart
SUSE 11/12
Run the following command to modify the /etc/modprobe.d/50-ipv6.conf
configuration file.
vi /etc/modprobe.d/50-ipv6.conf
Press the i
key to enter edit mode and delete the install ipv6 /bin/true
content.
After you finish, press the Esc
key to exit edit mode. Enter :wq
and press the Enter key to save and exit.
Run the following command to modify the vi /etc/sysctl.conf
configuration file.
vi /etc/sysctl.conf
Press the i
key to enter edit mode. Find the following content and replace the value 1
with 0
.
net.ipv6.conf.all.disable_ipv6 = 0 net.ipv6.conf.default.disable_ipv6 = 0 net.ipv6.conf.lo.disable_ipv6 = 0
After you finish, press the Esc
key to exit edit mode. Enter :wq
and press the Enter key to save and exit.
Run the following command for the configuration to take effect.
sysctl -p
If the output contains inet6
content, the IPv6 service is enabled. Configure the IPv6 address.
Configure the IPv6 address.
Alibaba Cloud Linux 2/3, CentOS 6/7, Red Hat 6/7
Run the following command to modify the NIC configuration file.
vi /etc/sysconfig/network-scripts/ifcfg-eth0
Replace eth0
with the actual NIC interface name. After you finish, save and exit.
Press the i
key to enter edit mode and add the following configuration to the file based on your network information.
DHCPV6C=yes IPV6INIT=yes
After you finish, press the Esc
key to exit edit mode. Enter :wq
and press the Enter key to save and exit.
Restart the ECS instance for the configuration to take effect. For more information, see Restart an instance.
CentOS 8
Check whether the NIC configuration file contains IPV6INIT=yes
and DHCPV6C=yes
. If it does, proceed to the next step. If not, add them manually.
vi /etc/sysconfig/network-scripts/ifcfg-eth0
eth0
is the NIC identifier. Replace it with the actual identifier. After you finish, save and exit.
Disable cloud-init from modifying NIC files in the /etc/sysconfig/network-scripts/
directory.
Note You do not need to manually configure the assigned IPv6 address, but the address may be lost after a restart. Therefore, you must disable cloud-init from modifying NIC files.
Run vi /etc/cloud/cloud.cfg
to open the cloud-init configuration file.
vi /etc/cloud/cloud.cfg
Add the following information before the Example datasource config
content:
network: config: disabled
After you finish, save and exit.
Restart the ECS instance for the configuration to take effect. For more information, see Restart an instance.
Debian 8/9/10/11 and Ubuntu 16
Run vi /etc/network/interfaces
to open the NIC configuration file and add the following content based on your network information:
iface eth0 inet6 dhcp
Replace eth0
with the actual NIC interface name. After you finish, save and exit.
Restart the ECS instance for the configuration to take effect. For more information, see Restart an instance.
Ubuntu 18/20
Disable cloud-init from modifying NIC files in the /etc/sysconfig/network-scripts/
directory.
Note You do not need to manually configure the assigned IPv6 address, but the address may be lost after a restart. Therefore, you must disable cloud-init from modifying NIC files.
Run vi /etc/cloud/cloud.cfg
to open the cloud-init configuration file.
vi /etc/cloud/cloud.cfg
Add the following information before the Example datasource config
content:
network: config: disabled
After you finish, save and exit.
Restart the ECS instance for the configuration to take effect. For more information, see Restart an instance.
Ubuntu 14
Run vi /etc/network/interfaces
to open the NIC configuration file and add the following content based on your network information:
iface eth0 inet6 dhcp
Replace eth0
with the actual NIC interface name. After you finish, save and exit.
Restart the ECS instance for the configuration to take effect. For more information, see Restart an instance.
FreeBSD 11
Run the vi /etc/rc.conf
command to open the NIC configuration file and add the following content based on your network information:
ipv6_enable="YES" ipv6_ifconfig_vtnet0="<IPv6 address> <Subnet prefix length>"
Replace vtnet0
with the actual NIC interface name. After you finish, save and exit.
Continue to modify the following information in the file. After you finish, save and exit.
ip6addrctl_enable="YES" ipv6_activate_all_interfaces="YES" ipv6_network_interfaces="auto"
After modification, the configuration file content is similar to the following:
hostname="Aliyun" sshd_enable="YES" dumpdev="NO" ipv6_enable="YES" ip6addrctl_enable="YES" ip6addrctl_policy="ipv4_prefer" ipv6_activate_all_interfaces="YES" ipv6_network_interfaces="auto" ifconfig_lo0="inet 127.0.0.1 netmask 255.0.0.0" ifconfig_vtnet0="inet 192.168.XX.XX netmask 255.255.255.0" ipv6_ifconfig_vtnet0="2001:XXXX:4:4:4:4:4:4 prefixlen 64" defaultrouter="192.168.XX.XX" hostname="freebsd"
Restart the ECS instance for the configuration to take effect. For more information, see Restart an instance.
Anolis OS 7.9/8.4, CentOS Stream, and Fedora
Check whether the NIC configuration file contains IPV6INIT=yes
and DHCPV6C=yes
. If it does, no further action is needed. If not, add them manually.
vi /etc/sysconfig/network-scripts/ifcfg-eth0
Replace eth0
with the actual NIC interface name. After you finish, save and exit.
Restart the ECS instance for the configuration to take effect. For more information, see Restart an instance.
Manually configure (Windows)
Remotely connect to the Windows instance.
For more information, see Log on to a Windows instance using a Workbench remote connection (RDP).
Open the command-line tool and run the ipconfig
command to check whether the IPv6 service is enabled on the instance.
If the output does not contain inet6
, the IPv6 service is disabled. Enable the IPv6 service.
How to enable the IPv6 service
Choose .
Click the current network connection name to open the status window, and then click Properties.
Select Internet Protocol Version 6 (TCP/IPv6).
For Windows Server 2008, 2012, 2016, 2019, and 2022, perform the following steps:
Check whether the IPv6 protocol row is selected. If not, select it and click OK.
For Windows Server 2003, perform the following steps:
Perform different operations based on whether the IPv6 protocol exists.
If the IPv6 protocol exists:
Select Internet Protocol Version 6 (TCP/IPv6) and click OK.
If the IPv6 protocol does not exist:
On the local connection properties page, click Install. On the network component type page, click .
On the Select Network Protocol page, choose to complete the installation.
Select Internet Protocol Version 6 (TCP/IPv6) and click OK.
If the output contains inet6
content, the IPv6 service is enabled. Configure the IPv6 address.
Configure the IPv6 address.
Obtain the generated IPv6 address from the instance details page.
Configure the IPv6 address.
For Windows Server 2008, 2012, and 2016, perform the following steps:
Choose .
Click the current network connection name to open the status window, and then click Properties.
Choose .
Select Use The Following IPv6 Address, enter the IPv6 address, subnet prefix length, and IPv6 gateway, and then click OK.
(Optional) To attach multiple IPv6 addresses, on the Internet Protocol Version 6 (TCP/IP) Properties dialog box, click Advanced to open the advanced settings dialog box. Click Add to add more addresses. When you are finished, click OK.
For Windows Server 2003, perform the following steps:
Choose and view the current network connection name. For example, Local Connection 2.
On the Windows desktop, use the Win+R
keyboard shortcut to open the Run dialog box. Enter the cmd
command and click OK to open the command-line tool.
Add the IPv6 address.
To add a single IPv6 address, run the following command:
netsh interface ipv6 add address "Local Connection 2" <IPv6 address>
To add multiple IPv6 addresses, run the following commands:
netsh interface ipv6 add address "Local Connection 2" <IPv6 address 1> netsh interface ipv6 add address "Local Connection 2" <IPv6 address 2>
Run the following command to add a default route.
netsh interface ipv6 add route ::/0 "Local Connection 2" <IPv6 gateway>
(Conditionally required) If your ECS instance runs a Linux system, perform this step. Otherwise, skip this step.
Run the following command to check whether the instance has the multi-NIC configuration tool installed.
ls /sbin/eni-ifscan
If the output is as shown in the following figure, the instance has the multi-NIC configuration tool pre-installed. You need to modify the eni-function
file of the multi-NIC configuration tool.
Note If a Linux instance has the multi-NIC configuration tool pre-installed, the IPv6 NICs in the Linux system cannot be automatically recognized because the tool does not support IPv6 by default. After the instance is restarted, the system fails to obtain an IPv6 address.

How to modify the eni-function
file
Run the following command to modify the eni-function
file.
vim /etc/eni_utils/eni-function
Press the i
key to enter edit mode. Change IPV6INIT=no
to IPV6INIT=yes
and add a DHCPV6C=yes
line. After modification, save and exit.

Verify the configuration. The configuration is successful if the ifconfig
or ipconfig
command returns the result shown in the first part of this step.
At this point, the ECS instance has IPv6 private network communication capabilities. You can test the private network connectivity as follows.
Test private network connectivity
Note When you test IPv6 network connectivity, ensure that both the server and the client support and have configured IPv6. In this example, for two ECS instances to communicate with each other, both your ECS01 and ECS02 instances must have IPv6 configured.
On the ECS01 instance, run the ping6 <ECS02 private IPv6 address>
command to ping
the IPv6 address of the ECS02 instance and test whether private communication is working.
If you receive reply messages, communication is successful. This indicates that IPv6 private communication from the ECS01 instance to the ECS02 instance is working.
On the ECS02 instance, run the ping6
command to ping
the IPv6 address of the ECS01 instance and test whether private communication is working.
If you receive reply messages, communication is successful. This indicates that IPv6 private communication from the ECS02 instance to the ECS01 instance is working.
Step 4: Enable IPv6 public bandwidth
By default, the IPv6 address of an ECS instance can be used for private network communication only. If you want to access the Internet or be accessed from the Internet through this IPv6 address, you must enable public bandwidth for the IPv6 address.
Log on to the VPC console.
In the navigation pane on the left, choose .
- In the top navigation bar, select the region where the IPv6 gateway is deployed.
On the IPv6 Gateway page, find the IPv6 gateway that corresponds to the VPC ID of the instance, and then click the IPv6 gateway ID.
On the details page of the IPv6 gateway, click the IPv6 Internet Bandwidth tab, find the IPv6 address for which you want to enable Internet bandwidth, and then click Activate Internet Bandwidth in the Actions column.
On the IPv6 Internet Bandwidth (PostPay) page, specify the parameters described in the following table, click Buy Now, and then complete the payment.
Parameter | Description |
Traffic | Select a metering method for the Internet bandwidth. Valid values: Pay-By-Bandwidth and Pay-By-Data-Transfer. For more information, see Billing. |
Bandwidth | Specify a maximum value for the Internet bandwidth. |
Billing cycle | Select a billing cycle for the Internet bandwidth. Valid values: Day (By Day) and Hour (By Hour). If you set Traffic to Pay-By-Bandwidth, you can select only Day (By Day). If you set Traffic to Pay-By-Data-Transfer, you can select only Hour (By Hour).
|
After you enable IPv6 public bandwidth, you can test the public connectivity of the IPv6 address.
Note When you test IPv6 network connectivity, ensure that both the server and the client support and have configured IPv6.
ping -6 aliyun.com
If the system returns information as shown in the following figure, the network connection is successful.
Note In this example, the website aliyun.com supports IPv6. After your ECS instance is configured, you can access aliyun.com over IPv6.
Other operations
Add an IPv6 security group rule
IPv4 and IPv6 communication are independent of each other. If the current security group rules do not meet your business requirements, you must configure a separate IPv6 security group rule for your ECS instance to enhance network security.
How to add an IPv6 security group rule
Go to ECS console - Security Groups.
In the top navigation bar, select the region and resource group of the resource that you want to manage.
Find the target security group and click Manage Rules in the Actions column.
On the security group details page, in the Access Rule section, click the Inbound or Outbound tab.
Add a security group rule. For more information, see Add a security group rule.
Note Set Source to an IPv6 CIDR block, such as 2001:db8:1234:1a00::***
. For more information about security group rules, see Security group rules.

Delete an assigned IPv6 address
If your ECS instance no longer needs an IPv6 address, you can delete it. After you delete the IPv6 address, you can still use the IPv4 address. This section describes how to delete an IPv6 address in the ECS console.
Important Ensure that the instance is in the Running or Stopped state.
Procedure
Go to ECS console - Elastic Network Interfaces.
In the top navigation bar, select the region and resource group of the resource that you want to manage.
On the Elastic Network Interfaces page, find the ENI that is attached to the target instance and is assigned an IPv6 address. Then, click Manage ENI IP Addresses in the Actions column.
In the Manage ENI IP Addresses dialog box, click the
icon next to the target IPv6 address that you want to delete.
Click OK.