This guide will help you build a Virtual Private Cloud (VPC) with IPv6 CIDR, and enable IPv6 for the Cloud Virtual Machine (CVM) in the VPC to implement IPv6 VPC and public network communications.
Overview
- CVMs are IPv6-enabled to communicate with other CVMs in the VPC through the IPv6 private network.
- CVMs are IPv6-enabled to communicate bidirectionally with IPv6 users on the Internet.

Instructions
- The IPv6 address is a GUA address. Each VPC is allocated with one
/56IPv6 CIDR, each subnet is allocated with one/64IPv6 CIDR, and each Elastic Network Interface (ENI) is allocated with one IPv6 address. - Both the primary network interface and the secondary network interface support applying for IPv6 addresses. For more information about the relationship between CVM and ENI, see Elastic Network Interface product documentation.
Directions
Step 1: Allocating IPv6 CIDR to VPC.
- Log in to the VPC Console.
- Select a region that supports IPv6, and in the operation column of the VPC row, click Obtain IPv6 Address.
The system will allocate one /56 IPv6 address segment for VPC. You can view detailed information about the IPv6 address segment in the list.

Step 2: Allocating IPv6 CIDR to Subnet.
- Log in to the VPC Console.
- In the left directory, choose Subnet to go to the management page.
- In the operation column of the row where the subnet is located in the VPC in Step 1, click Allocate IPv6 CIDR.

4. In the pop-up dialog box, allocate an IPv6 CIDR to the subnet and click OK.
The system will allocate one /64 IPv6 CIDR from VPC /56 IPv6 CIDR.
Step 3: Buying a CVM and Configuring IPv6 for the CVM.
After you allocate an IPv6 CIDR for a VPC and a subnet, you can create a CVM with an IPv6 address in the subnet, or obtain an IPv6 address for a CVM running in the subnet. Because IPv6 addresses cannot be automatically delivered to network interfaces, you still need to log in to the CVM console to configure IPv6 after obtaining the IPv6 address.
Log in to the Cloud Virtual Machine Purchase Page.
On the top of CVM purchase page, select Custom Configuration.
On the Select Region and Model tab, select a VPC and subnet that have been allocated with an IPv6 CIDR, set the instance type, and click Next: Select Image.
On the Select Image tab, set the image, operating system, system architecture, and image version, and click Next: Select Storage and Bandwidth.
On the Select Storage and Bandwidth tab, select the system disk type, specify whether to allocate a public network IP address now, check Allocate IPv6 Address, and click Next: Set Security Groups and Hosts.
On the Set Security Groups and Hosts tab, set the log-in password and other related parameters for security groups and instances, and click Next: Confirm Configuration Information.
On the Confirm Configuration Information tab, confirm that the CVM information is correct and click Enable.
After purchasing the CVM, you can view the IPv6 address information in the CVM list.
Note:
- If the CVM is not allocated with an IPv6 address when you purchase it, you can choose More > Elastic IP > Manage IPv6 Addresses in the operation column of the corresponding CVM instance to allocate an IPv6 address to the primary network interface.
- If you want to allocate IPv6 addresses to other ENIs in the CVM, see Applying for and Releasing IPv6.
- Log in to the CVM to configure IPv6. Because the methods of configuring IPv6 for various CVM operating systems are different, see Configuring IPv6 for Linux CVM and Configuring IPv6 for Windows CVM for detailed directions.
Step 4: Enabling the public network for the CVM IPv6 address (optional).
Log in to the VPC Console.
In the left directory, choose IP and Network Interface > Elastic IPv6.
Select the region where the CVM is located, click Apply to go to the management page.
Check the CVM IPv6 address, set the upper limit of the target bandwidth, and then click Submit.
Note:
- After the CVM has requested an IPv6 address, public network access is disabled by default. You can manage EIPv6 public network capabilities through Manage IPv6 Public Network Capabilities.
When the ISP type is BGP, the EIPv6 address is the IPv6 address obtained by the CVM. Please ensure that the CVM has obtained the IPv6 address.
A single operation can support enabling public network access for a maximum of 100 IPv6 addresses simultaneously. If more than 100 IPv6 addresses need public network access, please divide operations into multiple steps.

Step 5: Configuring IPv6 security group rules.
Note:
Inbound and outbound security group rules support configuration from a single IPv6 address or an IPv6 CIDR, where
::/130618222416261120represents all IPv6 source addresses.
Log in to the VPC Console.
In the left directory, choose Security > Security Group. On the list page, click the security group ID bound to the CVM to enter the details page.
Select Inbound Rules and click Add Rules to add an inbound security group rule for IPv6, then click Finish.
Select Outbound Rules and click Add Rules to add an outbound security group rule for IPv6 and click Finish.
Step 6: Testing IPv6 connectivity.
Note:
- If you are testing public network connectivity, make sure that the public network has been enabled.
- If the public network is not enabled to use SSH or remote desktop to test IPv6 connectivity, you can use the CVM SSH in the same VPC or the CVM tested through the remote desktop.
Linux CVM
The Linux CVM can test IPv6 connectivity through operations such as Ping or ssh.
- Execute
ping6 IPv6 addressin the CVM to run a test, for example,ping6 240c::6666,ping6 www.google.com, andping6 IPv6 address in the same VPC. The successful result is shown in the figure below:

Method 2: Use SSH to log in to the CVM via IPv6 address, follow these steps: Run the following command to view the IPv6 address, and use PuTTY or Xshell and other software to test whether you can use ssh to log in to the CVM through the IPv6 address.
ifconfig

The successful result is shown in the figure below.

Windows CVM
Windows CVM can test IPv6 connectivity via Ping or remote desktop.
Method 1: Test via Ping, follow these steps:
On the operating system interface, select
in the lower left corner, click
to open the Windows PowerShell window, and execute ping -6 IPv6 addressto run a test, for example,ping -6 240c::6666orping -6 the IPv6 address in the same VPC. The successful result is shown in the figure below.Method 2: Use the IPv6 address for remote desktop operation. For details on remote desktop operation, see Use Remote Desktop Connection to Log in to a Windows Instance.
Appendix
Configuring IPv6 for Linux CVM
There are two ways to configure IPv6 for Linux CVM: tool configuration and manual configuration.
- Tool Configuration: You can use the tool to configure IPv6 with one click.
- Manual Configuration: A certain level of proficiency in Linux commands is required.
Select the corresponding method according to your actual situation. It is recommended to use a more efficient automatic configuration tool to configure the IPv6 address.
| Image Type | Purchased Time | Is IPv6 enabled? | Tool Configuration (Recommended) |
Manual Configuration |
|---|---|---|---|---|
| CentOS 7.5/CentOS 7.6 | Purchase before 2019-06-30 | No | enable_ipv6 tool | The following are four common mirror operation methods. If they do not meet your needs, submit a Ticket. - Configuring IPv6 for newly purchased CentOS 7.5/newly purchased CentOS 7.6 - Configuring IPv6 for CentOS 6.8 - Configuring IPv6 for CentOS 7.3/Stock CentOS 7.5/Stock CentOS 7.6 - Configuring IPv6 for Debian 8.2 |
| CentOS 7.5/CentOS 7.6 | Purchased after 2019-06-30 | Yes | config_ipv6 tool | The following lists the operation methods for four commonly used images. If they do not meet your needs, please submit a work order request: Configure IPv6 for New CentOS 7.5/New CentOS 7.6 Configure IPv6 for CentOS 6.8 Configure IPv6 for CentOS 7.3/Existing CentOS 7.5/Existing CentOS 7.6 Configure IPv6 for Debian 8.2 |
| CentOS 6/CentOS 7 (excluding 7.5/7.6) Ubuntu14.04/Ubuntu 12.04 Debian 8/Debian 9 CoreOS 17 |
Purchase before 2019-11-13 01:00 | No | enable_ipv6 tool | The following lists the operation methods for four commonly used images. If they do not meet your needs, please submit a work order request: Configure IPv6 for New CentOS 7.5/New CentOS 7.6 Configure IPv6 for CentOS 6.8 Configure IPv6 for CentOS 7.3/Existing CentOS 7.5/Existing CentOS 7.6 Configure IPv6 for Debian 8.2 |
| CentOS 6/CentOS 7 (excluding 7.5/7.6) Ubuntu14.04/Ubuntu 12.04 Debian 8/Debian 9 CoreOS 17 |
Purchase after 2019-11-13 01:00 | Yes | config_ipv6 tool | The following lists the operation methods for four commonly used images. If they do not meet your needs, please submit a work order request: Configure IPv6 for New CentOS 7.5/New CentOS 7.6 Configure IPv6 for CentOS 6.8 Configure IPv6 for CentOS 7.3/Existing CentOS 7.5/Existing CentOS 7.6 Configure IPv6 for Debian 8.2 |
| FreeBSD,Suse,Ubuntu18 | Purchase before 2019-11-13 01:00 | No | Not supported. | The following lists the operation methods for four commonly used images. If they do not meet your needs, please submit a work order request: Configure IPv6 for New CentOS 7.5/New CentOS 7.6 Configure IPv6 for CentOS 6.8 Configure IPv6 for CentOS 7.3/Existing CentOS 7.5/Existing CentOS 7.6 Configure IPv6 for Debian 8.2 |
| FreeBSD,Suse,Ubuntu18 | Purchase after 2019-11-13 01:00 | Yes | Not supported. | The following lists the operation methods for four commonly used images. If they do not meet your needs, please submit a work order request: Configure IPv6 for New CentOS 7.5/New CentOS 7.6 Configure IPv6 for CentOS 6.8 Configure IPv6 for CentOS 7.3/Existing CentOS 7.5/Existing CentOS 7.6 Configure IPv6 for Debian 8.2 |
Tool Configuration
Select the corresponding configuration method according to whether IPv6 is enabled for the CVM:
- For CVM without IPv6 enabled: enable_ipv6 tool configuration .
- CVM with IPv6 enabled: config_ipv6 tool configuration .
enable_ipv6 Tool Configuration
The enable_ipv6 tool can configure IPv6 addresses for CVM instances that have been allocated with IPv6 addresses with one click.
Limits
- The enable_ipv6 tool is only applicable to VPC network environments.
- The enable_ipv6 tool will automatically restart the network interface and network service when it runs. The network may be unavailable for a short time. Execute with caution.
Directions
Log in to the CVM and directly execute the following command in the CVM to download the enable_ipv6 tool:
wget https://iso-1251783334.cos.ap-city.test.com/scripts/enable_ipv6.shAfter you grant execution permissions, execute with administrator permissions:
chmod +x ./enable_ipv6.sh ./enable_ipv6.sh [Network interface name] # Example 1: ./enable_ipv6.sh eth0 # Example 2: ./enable_ipv6.sh eth1(This step is only applicable to the CoreOS operating system.) Restart the CVM to make the above configuration take effect.
config_ipv6 Tool Configuration
The config_ipv6 tool can configure IPv6 addresses for CVM instances that have IPv6 enabled and have been allocated with IPv6 addresses with one click.
Limits
- The config_ipv6 tool is only applicable in a VPC network environment.
- When the config_ipv6 tool is running, it will automatically restart the network interface and network service. The network may be unavailable for a short time. Execute with caution.
Directions
Log in to the CVM and execute the following command directly in the CVM to download the config_ipv6 tool:
wget https://iso-1251783334.cos.ap-city.test.com/scripts/config_ipv6.shAfter you grant execution permissions, execute with administrator permissions:
chmod +x ./config_ipv6.sh ./config_ipv6.sh [Network interface name] # Example 1: ./config_ipv6.sh eth0 # Example 2: ./config_ipv6.sh eth1(This step is only applicable to the CoreOS operating system.) Restart the CVM to make the above configuration take effect.
For automatic configuration of IPv6 instances, such as batch configuration, it is recommended to call using instance custom data in conjunction with scripts. For details, see Instance Custom Data. The following is a script example (assuming it is a RHEL series, Bash Shell script).
Note:
This example only configures eth0. In actual operation, make sure to modify it to the actual network interface name.
#!/bin/sh
install_dir=/usr/sbin
install_path="$install_dir"/config-ipv6
if [ ! -f "$install_path" ]; then
tool_url="https://iso-1251783334.cos.ap-city.test.com/scripts/config_ipv6.sh"
# download the tool
if ! wget "$tool_url" -O "$install_path"; then
echo "[Error] download tool failed, code $?"
exit "$?"
fi
fi
# chmod the tool
if ! chmod +x "$install_path"; then
echo "[Error] chmod tool failed, code $?"
exit "$?"
fi
# run the tool
$install_path eth0
Manual Configuration
The following are four common Linux CVM operation methods:
- Configuring IPv6 for newly purchased CentOS 7.5/newly purchased CentOS 7.6
- Configuring IPv6 for CentOS 6.8
- Configuring IPv6 for CentOS 7.3/Stock CentOS 7.5/Stock CentOS 7.6
- Configuring IPv6 for Debian 8.2
Note:
- Newly purchased CentOS 7.5/Newly purchased CentOS 7.6 refers to CVM purchased after June 30, 2019.
- Stock CentOS 7.5/Stock CentOS 7.6 refers to CVM purchased before June 30, 2019.
Configuring IPv6 for newly purchased CentOS7.5/Newly purchased CentOS7.6
Log in to the Cloud Virtual Machine console and the instance.
Execute the following command to open the
ifcfg-eth0file in the folder/etc/sysconfig/network-scripts/.vim /etc/sysconfig/network-scripts/ifcfg-eth0Press i to switch to edit mode and add the following content.
DHCPV6C=yes

4. Press Esc and enter :wq to save the file and return.
5. Execute the following commands in sequence to check whether an IPv6 address has been obtained.
# If the CVM has multiple network interfaces, execute dhclient -6 network interface name, such as dhclient -6 eth0
dhclient -6 or dhclient -6 network interface name
ifconfig

6. Execute the following command to open sshd_config file in the folder /etc/ssh/.
vim /etc/ssh/sshd_config
- Press i to switch to edit mode and delete
AddressFamily anycomment (delete the preceding#), and enable IPv6 listening for applications such as ssh.

8. Press Esc and enter :wq to save the file and return.
9. Run the following command to restart the ssh process.
service sshd restart
- Run the following command to check whether ssh is listening on IPv6.
netstat -tupln

Configuring IPv6 for CentOS 6.8
Remotely connect instance. For detailed operations, see Log in and Remote Connection.
Execute the following command to check whether the IPv6 service is enabled for the instance:
ip addr | grep inet6 or ifconfig | grep inet6
- If the IPv6 service is not enabled for the instance, continue to enable IPv6 service according to the following steps.
- If
inet6related content is returned, it indicates the IPv6 service is enabled for the instance, and you can skip to Step 9 for the following operations.
Execute the following command to open the
ipv6.conffile in the folder/etc/modprobe.d/.vi /etc/modprobe.d/ipv6.confPress i to switch to edit mode and set the following kernel parameters to 0.
options ipv6 disable=0

5. Press Esc and enter :wq to save the file and return.
6. Execute the following command to open the sysctl.conf.first file in the folder etc.
vim /etc/sysctl.conf.first
Press i to switch to edit mode and set the following configuration file parameters to 0.
net.ipv6.conf.all.disable_ipv6 = 0

8. Press Esc and enter :wq to save the file and return.
9. Execute the following command to open the sysctl.conf.first file in the folder etc.
vi /etc/sysconfig/network
- Press i to switch to edit mode and add the following content.
NETWORKING_IPV6=yes
DHCPV6C=yes

11. Press Esc and enter :wq to save the file and return.
12. Execute the following command to open the network file in the folder /etc/sysconfig/.
vim /etc/sysconfig/network-scripts/route6-eth0
- Press i to switch to edit mode, add the following content, and add a default exit for IPv6 of the network interface.
default dev eth0

14. Press Esc and enter :wq to save the file and return.
15. Restart the CVM only through service network restart , IPv6 cannot be loaded normally.
16. Run the following command to check whether IPv6 is loaded normally after restart.
sysctl -a | grep ipv6 | grep disable

17. Execute the following commands in sequence to check whether an IPv6 address has been obtained.
# If the CVM has multiple network interfaces, execute dhclient -6 network interface name, such as dhclient -6 eth0
dhclient -6 or dhclient -6 network interface name
ifconfig

18. Execute the following command to open sshd_config file in the folder /etc/ssh/.
vim /etc/ssh/sshd_config
- Press i to switch to edit mode and delete
AddressFamily anycomment (delete the preceding#), and enable IPv6 listening for applications such as ssh.

- Press Esc and enter :wq to save the file and return.
- Run the following command to restart the ssh process.
service sshd restart
- Run the following command to check whether ssh is listening on IPv6.
netstat -tupln

Configuring IPv6 for CentOS 7.3/Stock CentOS 7.5/Stock CentOS 7.6
Remotely connect instance. For detailed operations, see Log in and Remote Connection.
Execute the following command to check whether the IPv6 service is enabled for the instance:
ip addr | grep inet6 or ifconfig | grep inet6
- If the IPv6 service is not enabled for the instance, continue to enable IPv6 service according to the following steps.
- If
inet6related content is returned, it indicates the IPv6 service is enabled for the instance, you can skip to Step 8 for the following operations.
Execute the following command to open
sysctl.conffile in the folderetc.vim /etc/sysctl.confPress i to switch to edit mode and set the following IPv6 related parameters to 0.
net.ipv6.conf.all.disable_ipv6 = 0 net.ipv6.conf.default.disable_ipv6 = 0 net.ipv6.conf.lo.disable_ipv6 = 0

Press Esc and enter :wq to save the file and return.
Run the following command to load the parameters.
sysctl -pRun the following command to check whether the modification is successful.
sysctl -a | grep ipv6 | grep disable
If the result is as follows, the modification has been successful.

8. Execute the following command to open or create ifcfg-eth0 file in the folder /etc/sysconfig/network-scripts/.
vim /etc/sysconfig/network-scripts/ifcfg-eth0
Press i to switch to edit mode and add the following content.
DHCPV6C=yes

10. Press Esc and enter :wq to save the file and return.
11. Execute the following command to open the network file in the folder /etc/sysconfig/.
vim /etc/sysconfig/network-scripts/route6-eth0
- Press i to switch to edit mode, add the following content, and add a default exit for IPv6 of the network interface.
default dev eth0

13. Press Esc and enter :wq to save the file and return.
14. Run the following command to restart the network interface.
service network restart
or
systemctl restart network
- Execute the following commands in sequence to check whether an IPv6 address has been obtained.
# If the CVM has multiple network interfaces, execute dhclient -6 network interface name, such as dhclient -6 eth0
dhclient -6 or dhclient -6 network interface name
ifconfig

16. Execute the following command to open sshd_config file in the folder /etc/ssh/.
vim /etc/ssh/sshd_config
- Press i to switch to edit mode and delete
AddressFamily anycomment (delete the preceding#), and enable IPv6 listening for applications such as ssh.

- Press Esc and enter :wq to save the file and return.
- Run the following command to restart the ssh process.
service sshd restart
- Run the following command to check whether ssh is listening on IPv6.
netstat -tupln

Configuring IPv6 for Debian 8.2
Remotely connect instance. For detailed operations, see Log in and Remote Connection.
Execute the following command to check whether the IPv6 service is enabled for the instance:
ip addr | grep inet6 or ifconfig | grep inet6
- If the IPv6 service is not enabled for the instance, continue to enable IPv6 service according to the following steps.
- If
inet6related content is returned, it indicates the IPv6 service is enabled for the instance, you can skip to Step 6 for the following operations.
Execute the following command to open
sysctl.conffile in the folderetc.vim /etc/sysctl.confPress i to switch to edit mode and set the following IPv6 related parameters to 0.
net.ipv6.conf.all.disable_ipv6 = 0 net.ipv6.conf.default.disable_ipv6 = 0Press Esc and enter :wq to save the file and return.
Run the following command to load the parameters.
sysctl -pExecute the following commands in sequence to check whether an IPv6 address has been obtained.
# If the CVM has multiple network interfaces, execute dhclient -6 network interface name, such as dhclient -6 eth0 dhclient -6 or dhclient -6 network interface name ifconfig

8. In the Debian 8.2 system, IPv6 listening is enabled for ssh (port 22) by default. No special configuration is required. You can run the following command to view it.
netstat -tupln

9. Run the following command to configure the default route.
ip -6 route add default dev eth0
Configuring IPv6 for Windows CVM
The following operation takes Windows 2012 as an example:
Log in to the CVM instance, choose Control Panel > Network and Internet > Network and Sharing Center of the operation system, and click and edit the Ethernet network interface.
In the Ethernet Status pop-up window, click Attribute.
In the Ethernet Attributes pop-up window, select Internet Protocol Version 6 (TCP/IPv6) and click Attribute.
In the Internet Protocol Version 6 (TCP/IPv6) Attribute pop-up window, manually enter the IPv6 address obtained by the CVM in Step 3 and set the DNS (recommended to use
240c::6666), and click OK.On the operating system interface, select
in the lower left corner, click
, open the Windows PowerShell window, and execute the following commands in sequence to configure the default route and view the IPv6 address.netsh interface ipv6 add route ::/130618223492100096 "Ethernet" ipconfig
in the lower left corner, click
to open the Windows PowerShell window, and execute