All Products
Search
Document Center

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

Last Updated:Dec 27, 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 the instance to communicate over IPv6, 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 vSwitch that you want 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 ECS instance, create an IPv6 VPC for the instance.

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

Step 2: Assign an IPv6 address

Before you configure an IPv6 address for an ECS 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 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. 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. In the Actions column, choose icon1 > Network and Security Group > Manage Secondary Private IP Address.

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

  6. To assign an IPv6 address, use one of the following methods:

    • Automatic assignment: Leave the field empty. The system randomly assigns an IPv6 address.

    • Manual assignment: Enter hexadecimal values in the field to complete the IPv6 address.

  7. Click Confirm.

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 ECS instance, take note of the following items:

  • In the Basic Configurations step, search for the instance types that support IPv6 and then select an instance type from the search results.

  • 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 IPv6 address is assigned.

After an IPv6 address is assigned to the instance, you can view information about the IP address in the ECS console. For more information, see View IP addresses.

(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 connect to the Internet by using the IPv6 address, 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 the IPv6 address

You can configure an IPv6 address for a network interface controller (NIC) of an ECS instance manually or by using automated tools. This way, the IPv6 address can be identified and takes effect in the operating system of the instance.

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

Note

If you use the automatic assignment method to assign an IPv6 address to an ECS instance, make sure that the instance can connect to the Internet to download the ecs-util-ipv6 tool.

Linux ECS instance

Automatically configure an IPv6 address (recommended)

The ecs-util-ipv6 tool can be used to configure IPv6 addresses that are assigned to instances or clear IPv6 settings 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 deployed in VPCs and depends on instance metadata. Before you use the tool, make sure that the network service is not disabled and that outbound access to 100.100.100.200 is allowed on port 80. For more information, see Overview of ECS instance metadata.

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

In this example, a CentOS instance is used. Perform the following steps:

  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 describes the download links of the ecs-util-ipv6 tool for different operating systems.

    Series

    Distribution

    Download link

    RHEL

    • CentOS 5, 6, 7, and 8

    • Red Hat 5, 6, and 7

    • Anolis OS

    • Fedora

    • Alibaba Cloud Linux 2 and 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 commands as an administrator to run the ecs-util-ipv6 tool:

    chmod +x ./ecs-utils-ipv6
    ./ecs-utils-ipv6
  4. (Optional) If the instance runs a Ubuntu 14 public image, restart the instance for the configurations to take effect. For more information, see Restart an instance.

    Note

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

    • You can run the following commands to enable IPv6, disable IPv6, or manually and automatically configure IPv6 addresses for NICs. By default, IPv6 addresses are automatically configured.

      ./ecs-utils-ipv6                 #By default, no parameters are specified and 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>      #Automatically configure an IPv6 address for an NIC.
      ./ecs-utils-ipv6 --static <NIC name> <IPv6 address> <Subnet prefix length> <IPv6 gateway>     #Manually 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 the same 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 of Cloud Assistant and Overview of ECS instance user data. Sample bash script that is supported for 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"

Manually 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 the 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 the instance. Proceed 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, press the Enter key to save the changes, and then exit Insert mode.

    4. Run the following command to check whether the configurations in the /etc/sysctl.conf file are consistent with those in the /etc/sysctl.conf file in the initram file system (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 configurations in the /etc/sysctl.conf 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 make the configurations 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 NIC identifier.

      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 in the file:

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

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

      reboot

Manually 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 the 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 the instance. Proceed 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, press the Enter key to save the changes, and then 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, press the Enter key to save the changes, and then exit Insert mode.

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

      Note

      If the instance operating system is CentOS 6, 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, press the Enter key to save the changes, and then exit Insert mode.

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

      sysctl -p

    Debian 8 and 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, press the Enter key to save the changes, and then 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, press the Enter key to save the changes, and then exit Insert mode.

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

    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, press the Enter key to save the changes, and then exit Insert mode.

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

      sysctl -p
    • Ubuntu 14 and 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, press the Enter key to save the changes, and then exit Insert mode.

    2. Run the following command for 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, press the Enter key to save the changes, and then exit Insert mode.

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

      /etc/netstart restart

    SUSE 11 and 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, press the Enter key to save the changes, and then 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 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, press the Enter key to save the changes, and then exit Insert mode.

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

      sysctl -p
  4. Configure an IPv6 address.

    Operating system

    Procedure

    • CentOS 6 and 7

    • Red Hat 6 and 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 NIC identifier.

      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 in the file:

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

    4. Run the following command to restart the instance to make the configurations 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 not, add the configurations to the file.

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

      In this example, eth0 is used. Replace eth0 with the actual NIC identifier. 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 the IPv6 addresses may be lost when the instance is restarted. You must disable the ability of cloud-init to modify NIC files.

      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.

    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. Replace eth0 with the actual NIC identifier. 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. Replace eth0 with the actual NIC identifier. 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 the IPv6 addresses may be lost when the instance is restarted. You must disable the ability of cloud-init to modify NIC files.

      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 additional operations are required. If not, add the configurations to the file.

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

      In this example, eth0 is used. Replace eth0 with the actual NIC identifier. 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

Automatically configure an IPv6 address (recommended)

The ecs-util-ipv6 tool can be used to configure IPv6 addresses for instances that are assigned IPv6 addresses or clear IPv6 settings 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 deployed in VPCs and depends on instance metadata. Before you use the tool, make sure that the network service is not disabled and that outbound access to 100.100.100.200 is allowed on port 80. For more information, see Overview of ECS instance metadata.

  • When the ecs-util-ipv6 tool is run, 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 username and password.

  2. Download a 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 the instance is assigned an IPv6 address, the IPv6 address is automatically configured. Otherwise, the existing IPv6 settings are automatically cleared.

If you want to configure IPv6 addresses for multiple instances at the same 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 of Cloud Assistant and Overview of ECS instance user data. Sample PowerShell script that is supported for Windows Server 2003, 2008, 2012, 2016, 2019, and 2022 64-bit operating systems:

#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

Manually configure an IPv6 address

To configure an IPv6 address, perform the following operations:

  1. Connect to the Windows instance.

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

  2. Check whether IPv6 is enabled for the 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 the 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. Click the name of the current network connection. In the dialog box that appears, click Properties.

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

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

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

      • To enable IPv6 on Windows Server 2003, perform the following operations:

        Perform the following operations based on whether IPv6 is displayed:

        • 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, select Microsoft TCP/IP Version 6 and click 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. Manually configure an IPv6 address.

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

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

      2. Click the name of the current network connection. In the dialog box that appears, click 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) To associate multiple IPv6 addresses, perform the following operations: 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.

    • To configure an IPv6 address on Windows Server 2003, perform the following operations:

      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 IPv6 addresses.

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

          netsh interface ipv6 add address "Local Area Connection 2" <IPv6 address>
        • Run the following commands 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

IPv4 communication and IPv6 communication are independent of each other. If the current security group rules do not meet your business requirements, configure IPv6 security group rules for your instances to increase network security.

  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 that you want to manage 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

    When you add an IPv6 security group rule, 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 Internet connectivity.

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 a 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 network connectivity:

    ping -6 aliyun.com

    The following command output indicates that the instance can access the website.ping -6

Windows instance

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

    For more information, see Connect to a Windows instance by using a username and 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 network connectivity:

    ping -6 aliyun.com

    The following command output indicates that the instance can access the website.ping -6