All Products
Search
Document Center

Elastic Compute Service:Configure an IPv6 address for an ECS instance

Last Updated:Oct 09, 2023

By default, when you create an Elastic Compute Service (ECS) instance, an IPv4 address instead of an IPv6 address is assigned to the instance. If you want to connect to the Internet from the instance by using an IPv6 address, configure an IPv6 address for the instance. This topic describes how to configure an IPv6 address for an ECS instance.

Prerequisites

  • Before you assign an IPv6 address to an instance when you create the instance in a virtual private cloud (VPC), the VPC and the vSwitch to connect to the instance are assigned IPv6 CIDR blocks. For more information, see Enable IPv6 for a VPC and Enable IPv6 for a vSwitch.

  • Before you assign an IPv6 address to an existing instance, the following requirements are met:

Procedure

The following flowchart shows how to use IPv6 addresses.

image

Step 1: Create an IPv6 VPC

Before you configure an IPv6 address for an instance, create an IPv6 VPC for the instance.

By default, VPCs use IPv4. You can enable IPv6 based on your business requirements. For information about IPv6 addresses, see Overview.

  • If you have not created VPCs, create a VPC and enable IPv6 for it. For more information, see the "Create a VPC that supports both IPv4 and IPv6" section of the Enable IPv6 for a VPC topic.

  • If you have created VPCs, enable IPv6 for an existing VPC. For more information, see the "Enable IPv6 for an existing VPC" section of the Enable IPv6 for a VPC topic.

Step 2: Assign an IPv6 address

Before you configure an IPv6 address for an instance, assign the IPv6 address to the instance. The IPv6 address allows the instance to access other instances or external networks over IPv6.

Scenario 1: Assign an IPv6 address to an existing instance

Note

You can configure event notifications in EventBridge or CloudMonitor to receive notifications for IP address events. After you assign an IPv6 address to an instance, you can receive a notification for the assignment. You can obtain information about the IPv6 address assignment, such as the IPv6 address and the associated elastic network interface (ENI) ID, and configure operations to be automatically performed in response to the notification. For more information, see Configure event notifications, ECS events, and the "Notifications for private IPv6 address assignment events" section of the IP address event notifications topic.

  1. Log on to the ECS console.

  2. In the left-side navigation pane, choose Instances & Images > Instances.

  3. In the upper-left corner of the top navigation bar, select a region. 地域

  4. Find the instance that you want to manage and choose More > Network and Security Group > Manage Secondary Private IP Address in the Actions column.

  5. In the Manage Secondary Private IP Address dialog box, click Assign New IP next to IPv6 Address.

  6. Use one of the following methods to assign an IPv6 address:

    • Auto-assignment: Do not specify an IP address in the field. This way, the system randomly assigns an IPv6 address to the instance.

    • Manual assignment: Specify an IPv6 address for the instance.

  7. Click OK.

Scenario 2: Assign an IPv6 address to a new instance

For information about how to create an instance, see Create an instance by using the wizard. When you create an instance, take note of the following items:

  • In the Basic Configurations step, find IPv6-supported instance types and select an instance type.

  • In the Networking step, make the following configurations:

    1. Select a VPC and vSwitch for which IPv6 is enabled.

    2. Select Assign IPv6 Address Free of Charge.

  • In the Preview step, confirm that an automatically selected IPv6 address or your specified IPv6 address is assigned.

(Optional) Step 3: Enable IPv6 public bandwidth

By default, the IPv6 address of an instance can be used only for communications on the internal network. To provide connectivity over IPv6 to and from the Internet, enable IPv6 public bandwidth.

  1. Log on to the VPC console.

  2. In the left-side navigation pane, choose Access to Internet > IPv6 Gateway.

  3. In the top navigation bar, select the region where the IPv6 gateway is deployed.
  4. On the IPv6 Gateway page, find the IPv6 gateway that corresponds to the VPC in which the instance resides and click the IPv6 gateway ID.

  5. On the IPv6 Gateway Details page, click the IPv6 Internet Bandwidth tab, find the IPv6 address for which you want to enable Internet bandwidth, and then click Create IPv6 Internet Bandwidth in the Actions column.

  6. On the IPv6 Internet Bandwidth (PostPay) page, set the parameters described in the following table, click Buy Now, and then complete the payment.

    Parameter

    Description

    Traffic

    Select a billing method for the Internet bandwidth.

    Valid values: Pay-By-Bandwidth and Pay-By-Data-Transfer. For more information, see Billing rules.

    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).

Step 4: Configure an IPv6 address

You can assign an IPv6 address to a network interface controller (NIC) of an instance manually or automatically by using tools. This allows the IPv6 address to be identified and take effect in the operating system of the instance.

This section describes how to configure an IPv6 address for Linux and Windows instances.

Linux instance

Automate IPv6 address configuration (recommended)

The ecs-util-ipv6 tool can be used to batch configure IPv6 addresses that are assigned to instances or batch clear IPv6 configurations for instances that are not assigned IPv6 addresses.

Note

The ecs-util-ipv6 tool has the following limits:

  • The ecs-util-ipv6 tool applies only to ECS instances that are located in VPCs and depends on instance metadata. Before you use this tool, make sure that you enable the network service and that allow outbound access to 100.100.100.200 on port 80. For more information, see Overview of ECS instance metadata.

  • When the ecs-util-ipv6 tool runs, NICs and the network service are restarted. This may cause a brief network interruption. Proceed with caution.

In this example, IPv6 address configuration is automated for a CentOS instance.

  1. Connect to the Linux instance.

    For more information, see Connect to a Linux instance by using a password or key.

  2. Run the following command to download the ecs-util-ipv6 tool:

    wget https://ecs-image-utils.oss-cn-hangzhou.aliyuncs.com/ipv6/rhel/ecs-utils-ipv6

    The following table lists the download URLs of the ecs-util-ipv6 tool for different operating systems.

    Series

    Distribution

    Download link

    RHEL

    • CentOS 5/6/7/8

    • Red Hat 5/6/7

    • Anolis OS

    • Fedora

    • Alibaba Cloud Linux 2/3

    Download link

    Debian

    • Ubuntu 14/16/18/20

    • Debian 8/9/10/11

    Download link

    SLES

    • SUSE 11/12/15

    • OpenSUSE 15/42

    Download link

    FreeBSD

    FreeBSD 11

    Download link

  3. Run the following command as an administrator to run the ecs-util-ipv6 tool.

    Note

    If your instance is assigned an IPv6 address, the IPv6 address is automatically configured. Otherwise, the existing IPv6 address configurations are automatically cleared.

    chmod +x ./ecs-utils-ipv6
    ./ecs-utils-ipv6
  4. Optional. If the instance image is an Ubuntu 14 public image, restart the instance to allow the configurations to take effect. For more information, see Restart instances.

You can run the following commands to enable IPv6, disable IPv6, configure IPv6 addresses for NICs, and automate IPv6 address configuration for NICs. By default, IPv6 address configuration is automated.

./ecs-utils-ipv6                 #By default, no parameter configurations are required. Multiple IPv6 addresses are automatically configured for multiple NICs.
./ecs-utils-ipv6 --enable    #Enable IPv6.
./ecs-utils-ipv6 --disable    #Disable IPv6.
./ecs-utils-ipv6 --static <NIC name>      #Have an IPv6 address automatically configured for an NIC.
./ecs-utils-ipv6 --static <NIC name> <IPv6 address> <Subnet prefix length> <IPv6 gateway>     #Configure one or more IPv6 addresses for one or more NICs. Separate the addresses with spaces and enclose each address in double quotation marks (" ").
Note

Replace <NIC name>, <IPv6 address>, <Subnet prefix length>, and <IPv6 gateway> with the actual values.

If you want to configure IPv6 addresses for multiple instances at a time, we recommend that you use Cloud Assistant or user data to configure a script that automates the configuration process. For more information, see Overview and Overview of ECS instance user data. Sample bash script that applies to RHEL operating systems:

#!/bin/sh
install_dir=/usr/sbin
install_path="$install_dir"/ecs-utils-ipv6
if [ ! -f "$install_path" ]; then
    tool_url="http://ecs-image-utils.oss-cn-hangzhou.aliyuncs.com/ipv6/rhel/ecs-utils-ipv6"
    # 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"

Configure an IPv6 address for an instance that runs an Alibaba Cloud Linux 2 or 3 operating system

  1. Connect to the Linux instance.

    For more information, see Connect to a Linux instance by using a password or key.

  2. Run the ip addr | grep inet6 or ifconfig | grep inet6 command to check whether IPv6 is enabled for the instance.

    Note

    IPv6 is disabled in Alibaba Cloud Linux 2 images of the aliyun_2_1903_64_20G_alibase_20190829.vhd version and earlier. By default, IPv6 is enabled in Alibaba Cloud Linux 2 images of the aliyun_2_1903_x64_20G_alibase_20200221.vhd version and later.

    • If the command output contains inet6 information, IPv6 is enabled for your instance. In this case, you can skip the "Enable IPv6" step and proceed to configure an IPv6 address

    • If the command output does not contain inet6 information, IPv6 is not enabled for your instance. Perform the following operations to enable IPv6.

  3. Enable IPv6.

    1. Run the following command to modify the /etc/sysctl.conf configuration file:

      vi /etc/sysctl.conf
    2. Press the I key to enter Insert mode, find the following content, and then replace 1 at the end of each line 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 IPv6 for a specific NIC, use the following settings:

      net.ipv6.conf.eth0.disable_ipv6 = 0
    3. Press the Esc key, enter :wq, and then press the Enter key to save the changes and exit Insert mode.

    4. Run the following command to check whether configurations in the /etc/sysctl.conf file are consistent with those in the /etc/sysctl.conf file in the initramfs:

      diff -u /etc/sysctl.conf <(lsinitrd -f /etc/sysctl.conf)
      Note

      An initramfs is configured for Alibaba Cloud Linux 2. If the configurations in the /etc/sysctl.conf file in the initramfs are inconsistent with those in the /etc/sysctl.conf file, the system may accept the file in the initramfs.

      If the configurations are inconsistent, run the following command to generate a new initramfs:

      sudo dracut -v -f
    5. Run the following command to restart the instance to allow the configurations to take effect:

      reboot
    6. Run the ifconfig command to check whether IPv6 is enabled.

      If the command output contains the following information, IPv6 is enabled.

      inet6 <Unicast address that starts with fe80::>
      inet6 <IPv6 address of the instance>
  4. Configure an IPv6 address.

    1. Run the following command to modify the NIC configuration file:

      Note

      Replace eth0 in the command with the actual identifier of your NIC.

      vi /etc/sysconfig/network-scripts/ifcfg-eth0
    2. Press the I key to enter Insert mode. Add the following configurations based on the actual information to the file:

      DHCPV6C=yes
      IPV6INIT=yes
    3. Press the Esc key, enter :wq, and then press the Enter key to save the changes and exit Insert mode.

    4. Run the following command to restart the instance to allow the configurations to take effect:

      reboot

Configure an IPv6 address for an instance that runs an operating system of another series

Perform the following operations to configure an IPv6 address for an instance that runs an operating system of another series, such as CentOS, Debian, Ubuntu, or Fedora.

  1. Connect to the Linux instance.

    For more information, see Connect to a Linux instance by using a password or key.

  2. Run the ip addr | grep inet6 or ifconfig | grep inet6 command to check whether IPv6 is enabled for the instance.

    Note

    By default, IPv6 is enabled on CentOS 8, Debian 10 and later, and Ubuntu 18 and later.

    • If the command output contains inet6 information, IPv6 is enabled for your instance. In this case, you can skip the "Enable IPv6" step and proceed to configure an IPv6 address.

    • If the command output does not contain inet6 information, IPv6 is not enabled for your instance. Perform the following operations to enable IPv6.

  3. Enable IPv6.

    Operating system

    Procedure

    CentOS 6/7

    1. Run the following command to modify the /etc/modprobe.d/disable_ipv6.conf configuration file:

      vi /etc/modprobe.d/disable_ipv6.conf
      1. Press the I key to enter Insert mode and change options ipv6 disable=1 to options ipv6 disable=0.

      2. Press the Esc key, enter :wq, and then press the Enter key to save the changes and exit Insert mode.

    2. Run the following command to modify the /etc/sysconfig/network configuration file:

      vi /etc/sysconfig/network
      1. Press the I key to enter Insert mode and change NETWORKING_IPV6=no to NETWORKING_IPV6=yes.

      2. Press the Esc key, enter :wq, and then press the Enter key to save the changes and exit Insert mode.

    3. Optional. Run the following commands in sequence to reload the IPv6 module.

      Note

      If your operating system is CentOS 6, you must perform this step. Otherwise, skip this step.

      modprobe ipv6 -r
      modprobe ipv6
      lsmod | grep ipv6

      If the IPv6 module is loaded, the following content is returned.

      ipv6                  xxxxx  8
      Note

      The parameter value on the third line of the returned content cannot be 0. Otherwise, you must re-enable IPv6.

    4. Run the following command to modify the /etc/sysctl.conf configuration file:

      vi /etc/sysctl.conf
      1. Press the I key to enter Insert mode, find the following content, and then replace 1 at the end of each line with 0.

        #net.ipv6.conf.all.disable_ipv6 = 1
        #net.ipv6.conf.default.disable_ipv6 = 1
        #net.ipv6.conf.lo.disable_ipv6 = 1
      2. Press the Esc key, enter :wq, and then press the Enter key to save the changes and exit Insert mode.

    5. Run the following command to allow the configurations to take effect:

      sysctl -p

    Debian 8/9

    1. Run the following command to modify the /etc/default/grub configuration file:

      vi /etc/default/grub
      1. Press the I key to enter Insert mode and delete ipv6.disable=1 from the file.

      2. Press the Esc key, enter :wq, and then press the Enter key to save the changes and exit Insert mode.

    2. Run the following command to modify the /boot/grub/grub.cfg configuration file:

      vi /boot/grub/grub.cfg
      1. Press the I key to enter Insert mode and delete ipv6.disable=1 from the file.

      2. Press the Esc key, enter :wq, and then press the Enter key to save the changes and exit Insert mode.

    3. Restart the Linux instance. For more information, see Restart instances.

    4. Run the following command to modify the /etc/sysctl.conf configuration file:

      vi /etc/sysctl.conf
      1. Press the I key to enter Insert mode, find the following content, and then replace 1 at the end of each line with 0.

        net.ipv6.conf.all.disable_ipv6 = 0
        net.ipv6.conf.default.disable_ipv6 = 0
        net.ipv6.conf.lo.disable_ipv6 = 0
      2. Press the Esc key, enter :wq, and then press the Enter key to save the changes and exit Insert mode.

    5. Run the following command to allow the configurations to take effect:

      sysctl -p
    • Ubuntu 14/16

    • OpenSUSE 42

      Note

      In openSUSE 42, after IPv6 is enabled, IPv6 addresses are automatically obtained and do not need to be manually configured.

    1. Run the following command to modify the vi /etc/sysctl.conf configuration file.

      vi /etc/sysctl.conf
      1. Press the I key to enter Insert mode, find the following content, and then replace 1 at the end of each line with 0.

        net.ipv6.conf.all.disable_ipv6 = 0
        net.ipv6.conf.default.disable_ipv6 = 0
        net.ipv6.conf.lo.disable_ipv6 = 0
      2. Press the Esc key, enter :wq, and then press the Enter key to save the changes and exit Insert mode.

    2. Run the following command to allow the configurations to take effect:

      sysctl -p

    FreeBSD 11

    1. Run the following command to modify the /etc/rc.conf configuration file:

      vi /etc/rc.conf
      1. Press the I key to enter Insert mode and add ipv6_activate_all_interfaces="YES" to the file.

      2. Press the Esc key, enter :wq, and then press the Enter key to save the changes and exit Insert mode.

    2. Run the following command to restart the network to allow the configurations to take effect:

      /etc/netstart restart

    SUSE 11/12

    Note

    In SUSE 11 and 12, after IPv6 is enabled, IPv6 addresses are automatically obtained and do not need to be manually configured.

    1. Run the following command to modify the /etc/modprobe.d/50-ipv6.conf configuration file:

      vi /etc/modprobe.d/50-ipv6.conf
      1. Press the I key to enter Insert mode and delete install ipv6 /bin/true from the file.

      2. Press the Esc key, enter :wq, and then press the Enter key to save the changes and exit Insert mode.

    2. Run the following command to modify the vi /etc/sysctl.conf configuration file.

      vi /etc/sysctl.conf
      1. Press the I key to enter Insert mode, find the following content, and then replace 1 at the end of each line to 0.

        net.ipv6.conf.all.disable_ipv6 = 0
        net.ipv6.conf.default.disable_ipv6 = 0
        net.ipv6.conf.lo.disable_ipv6 = 0
      2. Press the Esc key, enter :wq, and then press the Enter key to save the changes and exit Insert mode.

    3. Run the following command to allow the configurations to take effect:

      sysctl -p
  4. Configure an IPv6 address.

    Operating system

    Procedure

    • CentOS 6/7

    • Red Hat 6/7

    • Almalinux

    • Rocky Linux

    In this example, centos_6_10_x64_20G_alibase_20201120.vhd and centos_7_9_x64_20G_alibase_20211227.vhd are used.

    1. Run the following command to modify the NIC configuration file:

      Note

      Replace eth0 in the command with the actual identifier of your NIC.

      vi /etc/sysconfig/network-scripts/ifcfg-eth0
    2. Press the I key to enter Insert mode. Add the following configurations based on the actual information to the file:

      DHCPV6C=yes
      IPV6INIT=yes
    3. Press the Esc key, enter :wq, and then press the Enter key to save the changes and exit Insert mode.

    4. Run the following command to restart the instance to allow the configurations to take effect:

      reboot

    CentOS 8

    In this example, centos_8_5_x64_20G_alibase_20211228.vhd is used.

    1. Check whether the NIC configuration file contains the IPV6INIT=yes and DHCPV6C=yes configurations. If yes, proceed to the next step. If no, add the configurations to the file.

      vi /etc/sysconfig/network-scripts/ifcfg-eth0

      In this example, eth0 is used. You must replace it with the actual identifier of your NIC. Save the changes and exit.

    2. Forbid cloud-init to modify the NIC files in the /etc/sysconfig/network-scripts/ directory.

      Note

      Assigned IPv6 addresses do not need to be manually configured, but they may be lost when the instance is restarted. The ability of cloud-init to modify NIC files must be disabled.

      1. Run the vi /etc/cloud/cloud.cfg command to open the NIC configuration file:

        vi /etc/cloud/cloud.cfg
      2. Add the following information before Example datasource config:

        network:
          config: disabled

        Save the changes and exit.

    3. Run the reboot command to restart the instance.

    Ubuntu 14

    In this example, ubuntu_14_0405_64_20G_alibase_20170824.vhd is used.

    1. Run the vi /etc/sysctl.conf command to open the NIC configuration file. Make the following changes:

      #net.ipv6.conf.all.disable_ipv6 = 1
      #net.ipv6.conf.default.disable_ipv6 = 1
      #net.ipv6.conf.lo.disable_ipv6 = 1
      net.ipv6.conf.all.disable_ipv6 = 0
      net.ipv6.conf.default.disable_ipv6 = 0
      net.ipv6.conf.lo.disable_ipv6 = 0

      Save the changes and exit.

    2. Run the vi /etc/network/interfaces command to open the NIC configuration file and add the following content to the file based on the actual information:

      iface eth0 inet6 dhcp

      In this example, eth0 is used. You must replace it with the actual identifier of your NIC. Save the changes and exit.

    3. Run the reboot command to restart the instance.

    • Ubuntu 16

    • Debian 8/9/10/11

    In this example, debian_9_13_x64_20G_alibase_20211227.vhd, debian_10_11_x64_20G_alibase_20211227.vhd, debian_11_2_x64_20G_alibase_20211227.vhd, and ubuntu_16_04_x64_20G_alibase_20211028.vhd are used.

    1. Run the vi /etc/network/interfaces command to open the NIC configuration file and add the following content to the file based on the actual information:

      iface eth0 inet6 dhcp

      In this example, eth0 is used. You must replace it with the actual identifier of your NIC. Save the changes and exit.

    2. Run the reboot command to restart the instance.

    Ubuntu 18/20

    In this example, ubuntu_18_04_x64_20G_alibase_20211227.vhd and ubuntu_20_04_x64_20G_alibase_20211227.vhd are used.

    1. Forbid cloud-init to modify the NIC files in the /etc/sysconfig/network-scripts/ directory.

      Note

      Assigned IPv6 addresses do not need to be manually configured, but they may be lost when the instance is restarted. The ability of cloud-init to modify NIC files must be disabled.

      1. Run the vi /etc/cloud/cloud.cfg command to open the NIC configuration file:

        vi /etc/cloud/cloud.cfg
      2. Add the following content before Example datasource config:

        network:
          config: disabled

        Save the changes and exit.

    2. Run the reboot command to restart the instance.

    • Anolis OS 7.9/8.4

    • CentOS Stream

    • Fedora

    In this example, anolisos_7_9_x64_20G_rhck_alibase_20220110.vhd, anolisos_8_4_x64_20G_rhck_alibase_20211008.vhd, centos_stream_8_x64_20G_alibase_20211227.vhd, and fedora_34_1_x64_20G_alibase_20211028.vhd are used.

    1. Check whether the NIC configuration file contains the IPV6INIT=yes and DHCPV6C=yes configurations. If yes, no further operations are required. If no, add the configurations to the file.

      vi /etc/sysconfig/network-scripts/ifcfg-eth0

      In this example, eth0 is used. You must replace it with the actual identifier of your NIC. Save the changes and exit.

    2. Run the reboot command to restart the instance.

    FreeBSD 11

    In this example, freebsd_11_4_x64_30G_alibase_20210319.vhd is used.

    1. Run the vi /etc/rc.conf command to open the NIC configuration file and add the following content to the file based on the actual information:

      ipv6_enable="YES"
      ipv6_ifconfig_vtnet0="<IPv6 address> <Subnet prefix length>"
    2. Make the following changes to the file. Save the changes and exit.

      ip6addrctl_enable="YES"
      ipv6_activate_all_interfaces="YES"
      ipv6_network_interfaces="auto"

      After the changes are made, the configuration file contains the following content:

      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"
    3. Run the reboot command to restart the instance.

Windows instance

Automate IPv6 address configuration (recommended)

The ecs-util-ipv6 tool can be used to configure IPv6 addresses for instances that are assigned IPv6 addresses, or clear IPv6 configurations for instances that are not assigned IPv6 addresses.

The ecs-util-ipv6 tool has the following limits:

  • The ecs-util-ipv6 tool applies only to ECS instances that are located in VPCs and depends on instance metadata. Before you use this tool, make sure that you enable the network service and that allow outbound access to 100.100.100.200 on port 80. For more information, see Overview of ECS instance metadata.

  • When the ecs-util-ipv6 tool runs, NICs and the network service are restarted. This may cause a brief network interruption. Proceed with caution.

  1. Connect to the Windows instance.

    For more information, see Connect to a Windows instance by using a password.

  2. Download the version of the ecs-util-ipv6 tool based on the operating system of the instance:

  3. Run ecs-utils-ipv6.exe as an administrator.

    Important

    If your instance is assigned an IPv6 address, the IPv6 address is automatically configured. Otherwise, the existing IPv6 address configurations are automatically cleared.

If you want to configure IPv6 addresses for multiple instances at a time, we recommend that you use Cloud Assistant or user data to configure a script that automates the configuration process. For more information, see Overview and Overview of ECS instance user data. Sample PowerShell script that applies to 64-bit Windows Server 2003, 2008, 2012, 2016, 2019, and 2022:

#powershell
$install_dir="C:\Windows\system32"
$install_path = "$install_dir\ecs-utils-ipv6.exe"

if(-not (Test-Path -Path $install_path)){
    # download the tool
    $tool_url = 'http://ecs-image-utils.oss-cn-hangzhou.aliyuncs.com/ipv6/win/64/ecs-utils-ipv6.exe' 
    Invoke-WebRequest -uri $tool_url -OutFile $install_path
    Unblock-File $install_path
}

# run the tool
Start-Process -FilePath "$install_path" -ArgumentList "--noenterkey" -NoNewWindow

Configure an IPv6 address

Perform the following operations to configure an IPv6 address:

  1. Connect to the Windows instance.

    For more information, see Connect to a Windows instance by using a password.

  2. Check whether IPv6 is enabled for your instance.

    1. On the Windows desktop, press Win+R to open the Run dialog box. Then, enter cmd and click OK to open Command Prompt.

    2. Run the ipconfig command.

      If IPv6 address information is returned, IPv6 is enabled for your instance. Otherwise, IPv6 is not enabled for the instance. You must enable IPv6 for the instance.

  3. Enable IPv6.

    1. Choose Control Panel > Network and Sharing Center > Network Connections.

    2. In the View your active networks section of the Network and Sharing Center dialog box, click the current network connection name. In the Wi-Fi Status dialog box, click Wireless Properties.

    3. Select Internet Protocol Version 6 (TCP/IPv6).

      • Perform the following operations to enable IPv6 on Windows Server 2008, 2012, 2016, 2019, or 2022:

        Check whether the IPv6 option is selected. If the IPv6 option is not selected, select it and click OK.

      • Perform the following operations to enable IPv6 on Windows Server 2003:

        Perform the following operations as needed:

        • If IPv6 is displayed, select Internet Protocol Version 6 (TCP/IPv6) and click OK.

        • If IPv6 is not displayed, perform the following operations:

          1. In the Local Area Connection Properties dialog box, click Install. In the Select Network Component Type dialog box, choose Protocol > Add.

          2. In the Select Network Protocol dialog box, choose Microsoft TCP/IP Version 6 > OK.

          3. Select Internet Protocol Version 6 (TCP/IPv6) and click OK.

  4. On the instance details page, obtain the IPv6 address that is assigned in Step 2: Assign an IPv6 address.

  5. Configure an IPv6 address.

    • Perform the following operations to configure an IPv6 address on Windows Server 2008, 2012, or 2016:

      1. Choose Control Panel > Network and Internet > Network and Sharing Center.

      2. In the View your active networks section of the Network and Sharing Center dialog box, click the current network connection name. In the Wi-Fi Status dialog box, click Wireless Properties.

      3. Choose Internet Protocol Version 6 (TCP/IPv6) > Properties.

      4. Select Use the Following IPv6 Address, enter the IPv6 address, subnet prefix length, and IPv6 gateway, and then click OK.

      5. Optional. Assign multiple IPv6 addresses: In the Internet Protocol Version 6 (TCP/IP) Properties dialog box, click Advanced. In the Advanced Settings dialog box, click Add to add multiple IPv6 addresses, and then click OK.

    • Perform the following operations to configure an IPv6 address on Windows Server 2003:

      1. Choose Control Panel > Network Connections to view the current network connection name. In this example, Local Area Connection 2 is displayed.

      2. On the Windows desktop, press Win+R to open the Run dialog box. Then, enter cmd and click OK to open Command Prompt.

      3. Add an IPv6 address.

        • Run the following command to add a single IPv6 address:

          netsh interface ipv6 add address "Local Area Connection 2" <IPv6 address>
        • Run the following command to add multiple IPv6 addresses:

          netsh interface ipv6 add address "Local Area Connection 2" <IPv6 address 1>
          netsh interface ipv6 add address "Local Area Connection 2" <IPv6 address 2>
      4. Run the following command to add the default route:

        netsh interface ipv6 add route ::/0 "Local Area Connection 2" <IPv6 gateway>

Step 5: Add IPv6 security group rules

Services that are assigned IPv4 addresses and services that are assigned IPv6 addresses cannot communicate with each other. If the current security group rules do not support your IPv6 services, you must configure IPv6 security group rules for your ECS instances.

  1. Log on to the ECS console.

  2. In the left-side navigation pane, choose Network & Security > Security Groups.

  3. In the upper-left corner of the top navigation bar, select a region. 地域

  4. Find the security group to which you want to add rules and click Add Rules in the Actions column.

  5. On the details page of the security group, click the Inbound or Outbound tab in the Access Rule section.

  6. Add security group rules. For more information, see Add a security group rule.

    Note

    You must set Authorization Object to an IPv6 CIDR block. Example: 2001:db8:1234:1a00::***. For more information about security group rules, see Security group rules.

Step 6: Test the connectivity of the IPv6 address

After you enable IPv6 public bandwidth, make sure that the IPv6 address of the instance can provide connectivity to and from the Internet.

In the following examples, the ping -6 command is run to check whether the instance can access aliyun.com by using the IPv6 address.

Linux instance

  1. Connect to the Linux instance for which an IPv6 address is configured.

    For more information, see Connect to a Linux instance by using a password or key.

  2. Run the following command to test the network connectivity:

    ping -6 aliyun.com

    A command output similar to the following one indicates that the instance can access the website.ping -6

Windows instance

  1. Connect to the Windows instance for which an IPv6 address is configured.

    For more information, see Connect to a Windows instance by using a password.

  2. On the Windows desktop, press Win+R to open the Run dialog box. Then, enter cmd and click OK to open Command Prompt.

  3. Run the following command to test the network connectivity:

    ping -6 aliyun.com

    A command output similar to the following one indicates that the instance can access the website.ping -6