All Products
Search
Document Center

Elastic Compute Service:Enable IPv6 for ECS instances

Last Updated:May 29, 2026

Assign an IPv6 address to an ECS instance in an IPv6-enabled VPC, configure it on the OS, and enable public or private IPv6 communication.

Note

IPv6 solves IPv4 address scarcity by providing a vast address space, eliminating address conflicts and barriers for devices to connect to the internet.

Limitations

Regions that support IPv6 Gateway

Note

An IPv6 Gateway is a gateway for IPv6 traffic in a VPC. By default, an assigned IPv6 address provides only private network communication. You can enable public network communication by purchasing internet bandwidth for the IPv6 address through an IPv6 Gateway. For more information, see 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)

Unsupported ECS instance families

  • ic5 compute-intensive instance family

  • se1 memory-optimized instance family

  • d1 big data instance family

  • i2g and i1 local SSD-equipped instance families

  • hfc5 high-frequency compute-optimized and hfg5 high-frequency general-purpose instance families

  • ebmg5 general-purpose and ebmr5s memory-optimized network-enhanced ECS Bare Metal Instance families

  • xn4, n4, mn4, and e4 previous-generation burstable instance families

  • scch5 high-frequency Super Computing Cluster instance family

  • gn5 GPU-accelerated compute-optimized instance family

  • n1, n2, and e3 burstable instance families

  • sn2 and sn1 general-purpose instance families

IPv6 address limits per instance

The number of IPv6 addresses assignable to an ECS instance depends on the number of ENIs attachable to the instance and the number of IPv6 addresses assignable to each ENI.

  • The number of IPv6 addresses assignable to a single ENI depends on the instance family. See the Number of IPv6 addresses per ENI column in Instance families.

  • The number of ENIs attachable to a single instance is determined by the instance family. See the Elastic Network Interface column in Instance families.

Procedure

Note

You can use one-click deployment to quickly complete the following operations.

Step 1: Enable IPv6 for VPC and vSwitch

Ensure that IPv6 is enabled for the VPC and vSwitch where your ECS instance is located. See Enable IPv6 for a VPC and Enable IPv6 for a vSwitch.

image

image

Step 2: Assign an IPv6 address

Assign an IPv6 address to an ECS instance for IPv6 communication with other instances or external networks.

Assign to existing instance

  1. Go to ECS console - Instances.

  2. In the upper-left corner of the page, select a region and resource group.地域

  3. Find the target ECS instance and click its ID. Then, from the All Operations menu, choose Network and Security Group > Manage IPv6 Addresses.

    image

  4. In the Manage Secondary Private IP Address dialog box, under the IPv6 Supported section, click Add.

    If you do not need to specify an IPv6 address, leave the IPv6 address field empty. The system automatically assigns an address.
  5. Click OK.

Assign during creation

When creating an instance, note the following settings. For other configurations, see Create an instance by using the custom launch tab.

  • Networking: Select an IPv6-enabled VPC and vSwitch.

  • Instance: Click Select Instance Type, filter for IPv6 Supported instance types, and then select an instance type.image

    image

  • Networking: Click Elastic Network Interface | IPv6 (Optional), and then select Assign IPv6 Address Free of Charge.

    image

After the address is assigned, you can view its details in the ECS console. See View IP addresses.

Step 3: Configure the IPv6 address

Configure the IPv6 address on the instance NIC so the operating system can recognize and use it.

  1. Some images automatically configure and recognize IPv6 addresses. Check whether your instance's operating system has detected the IPv6 address:

    Linux instances

    1. Connect to the Linux instance.

      See Connect to a Linux instance by using Workbench.

    2. Run ip -6 addr show or ifconfig.

      1. If the output shows one global unicast address and one link-local address as in the following figure, the IPv6 address is detected. Skip the remaining configuration steps. Otherwise, proceed.

    image

    Windows instances

    1. Connect to the Windows instance.

      See Connect to a Windows instance by using Workbench.

    2. Open the command-line tool and run ipconfig.

      1. If the output shows one global unicast address and one link-local address as in the following figure, the IPv6 address is detected. Skip the remaining configuration steps. Otherwise, proceed.

    image

  2. Configure the IPv6 address.

    Important

    Automatic configuration requires Cloud Assistant. If your instance does not support Cloud Assistant or you prefer not to install it, configure the IPv6 address manually.

    (Recommended) Automatic configuration

    Prerequisites

    1. The Cloud Assistant client is installed on the instance. If not, see Install the Cloud Assistant client.

    2. 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 process uses Cloud Assistant and may restart the NIC or network services, causing a temporary network interruption.

    Procedure

    1. Connect to the Linux instance.

      See Connect to a Linux instance by using Workbench.

    2. Configure the IPv6 address:

      Note

      By default, this command checks whether the ecs-utils-ipv6 plug-in is installed and up to date. If not, the system downloads and installs the latest version automatically.

      sudo acs-plugin-manager --exec --plugin=ecs-utils-ipv6

    Manual configuration (Linux)

    1. Connect to the Linux instance.

      See Connect to a Linux instance by using Workbench.

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

      1. If no inet6 information is returned, IPv6 is disabled. Enable it as follows:

        How do I enable the IPv6 service?

        Alibaba Cloud Linux 2/3

        1. Modify /etc/sysctl.conf:

          vi /etc/sysctl.conf
        2. Press I to enter edit mode. Change the following values from 1 to 0:

          net.ipv6.conf.all.disable_ipv6 = 1
          net.ipv6.conf.default.disable_ipv6 = 1
          net.ipv6.conf.lo.disable_ipv6 = 1
        3. To enable a specific network interface, add the following:

          net.ipv6.conf.eth0.disable_ipv6 = 0
        4. Press Esc, enter :wq, and press Enter to save and exit.

        5. Check for differences between /etc/sysctl.conf and the /etc/sysctl.conf in the initramfs:

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

          Alibaba Cloud Linux 2 uses initramfs. If the /etc/sysctl.conf in initramfs differs from the main /etc/sysctl.conf, the system may apply an incorrect configuration on startup.

        6. If the two files differ, regenerate initramfs:

          sudo dracut -v -f
        7. Restart the ECS instance for the configuration to take effect. For more information, see Restart an instance.

        8. Run ip addr | grep inet6 or ifconfig | grep inet6 to verify that IPv6 is enabled.

          If inet6 information is returned, IPv6 is enabled.

        Alibaba Cloud Linux 4

        1. Modify the /etc/sysctl.conf file:

          vi /etc/sysctl.conf
        2. Press i to enter edit mode and add or modify the following content:

          net.ipv6.conf.all.disable_ipv6 = 0
          net.ipv6.conf.default.disable_ipv6 = 0
        3. Press Esc to exit edit mode, type :wq, and press Enter to save and exit.

        4. Run the following command to apply the configuration:

          sysctl -p
        5. Run ip -6 addr show to verify that IPv6 is enabled.

          If inet6 information is returned, IPv6 is enabled.

        CentOS 6/7

        1. Modify /etc/modprobe.d/disable_ipv6.conf:

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

          2. Press Esc, enter :wq, and press Enter to save and exit.

        2. Modify /etc/sysconfig/network:

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

          2. Press Esc, enter :wq, and press Enter to save and exit.

        3. (Optional) Reload the IPv6 module:

          Note

          For CentOS 6, this step is required. Otherwise, skip it.

          modprobe ipv6 -r
          modprobe ipv6
          lsmod | grep ipv6

          If the following is returned, the IPv6 module is loaded:

          ipv6                  xxxxx  8
          Note

          The third column value must not be 0. Otherwise, re-enable the IPv6 service.

        4. Modify /etc/sysctl.conf:

          vi /etc/sysctl.conf
          1. Press I to enter edit mode. Change the following values from 1 to 0:

            net.ipv6.conf.all.disable_ipv6 = 1
            net.ipv6.conf.default.disable_ipv6 = 1
            net.ipv6.conf.lo.disable_ipv6 = 1
          2. Press Esc, enter :wq, and press Enter to save and exit.

        5. Apply the configuration:

          sudo sysctl -p

        Debian 8/9

        1. Modify /etc/default/grub:

          vi /etc/default/grub
          1. Press I to enter edit mode and delete ipv6.disable=1.

          2. Press Esc, enter :wq, and press Enter to save and exit.

        2. Modify /boot/grub/grub.cfg:

          vi /boot/grub/grub.cfg
          1. Press I to enter edit mode and delete ipv6.disable=1.

          2. Press Esc, enter :wq, and press Enter to save and exit.

        3. Restart the instance.

        4. Modify /etc/sysctl.conf:

          vi /etc/sysctl.conf
          1. Press I to enter edit mode. Change the following values from 1 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 Esc, enter :wq, and press Enter to save and exit.

        5. Apply the configuration:

          sudo sysctl -p

        Ubuntu 14/16 and OpenSUSE 42

        1. Modify /etc/sysctl.conf:

          vi /etc/sysctl.conf
          1. Press I to enter edit mode. Change the following values from 1 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 Esc, enter :wq, and press Enter to save and exit.

        2. Apply the configuration:

          sysctl -p

        FreeBSD 11

        1. Modify /etc/rc.conf:

          vi /etc/rc.conf
          1. Press I to enter edit mode and add the ipv6_activate_all_interfaces="YES" line.

          2. Press Esc, enter :wq, and press Enter to save and exit.

        2. Restart the network to apply the configuration:

          /etc/netstart restart

        SUSE 11/12

        1. Modify /etc/modprobe.d/50-ipv6.conf:

          vi /etc/modprobe.d/50-ipv6.conf
          1. Press I to enter edit mode and delete the install ipv6 /bin/true line.

          2. Press Esc, enter :wq, and press Enter to save and exit.

        2. Modify /etc/sysctl.conf:

          vi /etc/sysctl.conf
          1. Press I to enter edit mode. Change the following values from 1 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 Esc, enter :wq, and press Enter to save and exit.

        3. Apply the configuration:

          sysctl -p
      2. If inet6 information is returned, IPv6 is enabled. Configure the IPv6 address.

    3. Configure the IPv6 address.

      Alibaba Cloud Linux 2/3, CentOS 6/7, and Red Hat 6/7

      1. Modify the NIC configuration file:

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

        Replace eth0 with the actual NIC name. Save and exit.

      2. Press I to enter edit mode and add the following configuration lines to the file.

        DHCPV6C=yes
        IPV6INIT=yes
      3. Press Esc, enter :wq, and press Enter to save and exit.

      4. Restart the ECS instance for the configuration to take effect. For more information, see Restart an instance.

      Alibaba Cloud Linux 4

      Note

      Alibaba Cloud Linux 4 uses NetworkManager for network management. NIC configuration files are stored in /etc/NetworkManager/system-connections/ instead of /etc/sysconfig/network-scripts/.

      1. Run the following command to view the network connection name:

        nmcli connection show

        Note the connection name, which is typically cloud-init eth0.

      2. Run the following command to enable IPv6 automatic address configuration:

        nmcli connection modify "cloud-init eth0" ipv6.method auto

        Replace cloud-init eth0 with your actual connection name. Use quotes when the connection name contains spaces.

      3. Run the following commands to reload and apply the configuration:

        nmcli connection reload
        nmcli connection up "cloud-init eth0"
      4. Restart the ECS instance for the configuration to take effect. For more information, see Restart an instance.

      CentOS 8

      1. Check whether the NIC configuration file contains IPV6INIT=yes and DHCPV6C=yes. If not, add them before proceeding.

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

        Replace eth0 with the actual NIC identifier. Save and exit.

      2. Disable the cloud-init NIC modification feature in /etc/sysconfig/network-scripts/.

        Note

        An assigned IPv6 address is automatically configured but may be lost after a restart. Disable the cloud-init NIC modification feature to prevent this.

        1. Open vi /etc/cloud/cloud.cfg:

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

          network:
            config: disabled

          Save and exit.

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

      1. Run vi /etc/network/interfaces to open the NIC configuration file and add the following line to the file:

        iface eth0 inet6 dhcp

        Replace eth0 with the actual NIC name. Save and exit.

      2. Restart the ECS instance for the configuration to take effect. For more information, see Restart an instance.

      Ubuntu 18/20

      1. Disable the cloud-init NIC modification feature in /etc/sysconfig/network-scripts/.

        Note

        An assigned IPv6 address is automatically configured but may be lost after a restart. Disable the cloud-init NIC modification feature to prevent this.

        1. Open vi /etc/cloud/cloud.cfg:

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

          network:
            config: disabled

          Save and exit.

      2. Restart the ECS instance for the configuration to take effect. For more information, see Restart an instance.

      Ubuntu 14

      1. Run vi /etc/network/interfaces to open the NIC configuration file and add the following line to the file:

        iface eth0 inet6 dhcp

        Replace eth0 with the actual NIC name. Save and exit.

      2. Restart the ECS instance for the configuration to take effect. For more information, see Restart an instance.

      FreeBSD 11

      1. Open vi /etc/rc.conf and add the following lines:

        ipv6_enable="YES"
        ipv6_ifconfig_vtnet0="<IPv6 address> <Subnet prefix length>"

        Replace vtnet0 with the actual NIC name. Save and exit.

      2. Add the following lines. Save and exit.

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

        After modification, the file looks similar to:

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

      1. Check whether the NIC configuration file contains IPV6INIT=yes and DHCPV6C=yes. If not, add them manually.

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

        Replace eth0 with the actual NIC name. Save and exit.

      2. Restart the ECS instance for the configuration to take effect. For more information, see Restart an instance.

    Manual configuration (Windows)

    1. Connect to the Windows instance.

      See Connect to a Windows instance by using Workbench.

    2. Open the command-line tool and run ipconfig to check whether IPv6 is enabled.

      1. If no inet6 information is returned, IPv6 is disabled. Enable it:

        How do I enable the IPv6 service?

        1. Go to Control Panel > Network and Sharing Center > Change adapter settings.

        2. Right-click the current network connection and select Type.

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

          1. For Windows Server 2008, 2012, 2016, 2019, and 2022:

            Check whether the checkbox for the IPv6 protocol is selected. If the checkbox is not selected, select it and click OK.

          2. For Windows Server 2003:

            The steps differ depending on whether the IPv6 protocol is installed.

            If the IPv6 protocol exists:

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

            The IPv6 protocol is not present:

            1. On the Local Area Connection Properties page, click Install. On the Select Network Component Type page, click Protocol > Add .

            2. On the Select Network Protocol page, select Microsoft TCP/IP Version 6 > OK to complete the installation.

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

      2. If inet6 information is returned, IPv6 is enabled. Configure the IPv6 address.

    3. Configure the IPv6 address.

      1. On the instance details page, obtain the assigned IPv6 address.

      2. Configure the IPv6 address.

        1. For Windows Server 2008, 2012, 2016, 2019, and 2022:

          1. Go to Control Panel > Network.

          2. Click the name of the current network connection to open the status dialog box, and then click Type.

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

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

          5. (Optional) To bind multiple IPv6 addresses, on the Internet Protocol Version 6 (TCP/IPv6) Properties page, click Premium to open the advanced settings. Then, click Add to enter another IPv6 address. When you have finished adding addresses, click OK.

        2. For Windows Server 2003:

          1. Go to Control Panel > Network Connections and find the name of the current network connection. In this example, the name is Local Area Connection 2.

          2. On the Windows desktop, press the Win+R keys to open the Run dialog box. Enter cmd and click OK to open the command-line tool.

          3. Add an IPv6 address.

            1. To add a single IPv6 address:

            2. netsh interface ipv6 add address "Local Area Connection 2" <IPv6 address>
            3. To add multiple IPv6 addresses:

            4. 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. Add a default route:

          5. netsh interface ipv6 add route ::/0 "Local Area Connection 2" <IPv6 gateway>
  3. (Conditional) This step applies only to Linux instances.

    Check whether the multi-ENI configuration tool is installed:

    ls /sbin/eni-ifscan

    If the command returns a path as shown below, the tool is pre-installed. Modify the eni-function file.

    Note

    If a Linux instance has the multi-ENI configuration tool pre-installed, the IPv6 NIC may not be detected automatically because the tool does not support IPv6 by default. The instance may fail to obtain an IPv6 address after a restart.

    image

    How to modify the eni-function file

    1. Modify the eni-function file:

      vim /etc/eni_utils/eni-function 
    2. Press I to enter edit mode. Change IPV6INIT=no to IPV6INIT=yes and add the DHCPV6C=yes line. Then, save the changes and exit.

      image

  4. If the ifconfig or ipconfig command returns the result from Step 1, the configuration is successful.

The ECS instance can now communicate over its private IPv6 address. Test private connectivity as follows:

Test private connectivity

Note

To test IPv6 connectivity, both the client and server must support and be configured for IPv6. In this example, both ECS01 and ECS02 must have IPv6 configured.

On ECS01, run ping6 <ECS02_private_IPv6_address> to ping the IPv6 address of ECS02.

Receiving reply packets confirms successful private IPv6 communication from ECS01 to ECS02.pingecs02

On ECS02, run ping6 <ECS01_private_IPv6_address> to ping the IPv6 address of ECS01.

Receiving reply packets confirms successful private IPv6 communication from ECS02 to ECS01.pingecs01

Step 4: Enable internet bandwidth for IPv6

By default, an IPv6 address provides only private network communication. To enable public access, purchase internet bandwidth for the IPv6 address.

  1. Log on to the VPC console.

  2. In the navigation pane on the left, choose Public Network Access > 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 you want to manage based on the VPC ID of the instance and click the ID of the IPv6 gateway.

  5. On the IPv6 Gateway details page, click the IPv6 Internet Bandwidth tab, find the target IPv6 address, and click Activate Internet Bandwidth in the Actions column.

  6. On the IPv6 Internet Bandwidth (Pay-as-you-go) page, set the following parameters, click Buy Now, and complete the payment.

    Parameter

    Description

    Traffic

    Metering method for internet bandwidth.

    Two methods are available: Pay-By-Bandwidth and Pay-By-Data-Transfer. Billing for IPv6 Gateway.

    Bandwidth

    Maximum bandwidth.

    Billing Cycle

    Billing cycle. Valid values: By Day and By Hour.

    • If the metering method is Pay-By-Bandwidth, the billing cycle is By Day.

    • If the metering method is Pay-By-Data-Transfer, the billing cycle is By Hour.

After you enable internet bandwidth for the IPv6 address, test public IPv6 connectivity:

Note

To test IPv6 connectivity, both the client and server must support and be configured for IPv6.

ping -6 aliyun.com

If the system returns output similar to the following figure, the connection is normal.ping -6

Note

In this example, aliyun.com supports IPv6. After your ECS instance is configured, you can access aliyun.com over IPv6.

More operations

Add IPv6 security group rules

IPv4 and IPv6 traffic are independent. Configure IPv6 security group rules if your current rules do not cover IPv6 traffic.

How to add IPv6 security group rules

  1. Go to ECS Console - Security Group.

  2. In the upper-left corner of the page, select a region and resource group.地域

  3. Find the target security group. In the Operation column, click Manage Rules.

  4. On the security group details page, find the Access Rule section and select Inbound or Outbound.

  5. See Add a security group rule.

    Note

    Set Source to an IPv6 CIDR block, such as 2001:db8:1234:1a00::***. See Security group rules.

    image

Delete an assigned IPv6 address

Delete an IPv6 address from an ECS instance when it is no longer needed. The IPv4 address remains unaffected.

Important

Make sure that the instance is in the Running or Stopped state.

Procedure

  1. Go to ECS Console - Elastic Network Interfaces.

  2. In the upper-left corner of the page, select a region and resource group.地域

  3. On the ENIs page, find the elastic network interface that is attached to the target instance and has an assigned IPv6 address. In the Operation column, click Manage Elastic Network Interface IPs.

  4. In the Manage Elastic Network Interface IPs dialog box, click the image.png icon next to the IPv6 address that you want to delete.

  5. Click OK.

References