By default, Virtual Private Cloud (VPC) uses the IPv4 addressing protocol. When you create a VPC, you must specify an IPv4 CIDR block for the VPC. However, if you want an Elastic Compute Service (ECS) instance that is deployed in a VPC to communicate with the Internet, you must request a public IP address for the instance. You can also enable the IPv6 addressing protocol to associate IPv6 CIDR blocks with VPCs. Each IPv6 address is globally unique. The IPv6 addresses assigned to ECS instances can be configured to remain private or reachable over the Internet.
Private IP addresses
In most cases, private IP addresses refer to private IPv4 addresses. A private IPv4 address is an IPv4 address that is not reachable over the Internet. You can use private IPv4 addresses to allow communication between ECS instances and internal resources. Private IPv4 addresses are assigned to ECS instances by using the Dynamic Host Configuration Protocol (DHCP). A private IPv4 address that is assigned to an ECS instance must be within the private IPv4 CIDR block of the vSwitch to which the instance is connected. The number of private IPv4 addresses that can be assigned to each elastic network interface (ENI) on an ECS instance varies based on the instance type. For more information, see the Private IPv4 Addresses per ENI columns in Overview of instance families.
Take note of the following items related to private IPv4 addresses:
When an ECS instance starts, the instance receives a primary private IPv4 address from the IPv4 CIDR block of the vSwitch to which the instance is connected. The primary private IPv4 address functions as the default egress private IP address. If you do not specify a primary private IPv4 address when you create an ECS instance, Alibaba Cloud assigns an available IPv4 address from the IPv4 CIDR block of the specified vSwitch to the instance. Each ECS instance has only one primary private IPv4 address, which is assigned to the primary ENI of the instance. After a primary private IPv4 address is assigned to an ECS instance, the primary private IPv4 address cannot be unassigned from the instance before the instance is released. You can change the primary private IPv4 address of an ECS instance. For more information, see Modify the private IP address of an instance.
You can also specify secondary private IPv4 addresses for ECS instances. Secondary private IPv4 addresses can be unassigned from ECS instances before the instances are released and reassigned to other ECS instances. After secondary private IPv4 addresses are assigned to ECS instances, you cannot modify the addresses. After secondary private IPv4 addresses are assigned to an ECS instance, you must configure the addresses in the operating system of the instance. For more information, see Assign secondary private IP addresses.
Private IPv4 addresses remain associated with ECS instances when the instances are stopped or started, and are released when the instances are released.
Public IP addresses
In most cases, public IP addresses refer to public IPv4 addresses. A public IPv4 address is an IPv4 address that is reachable over the Internet. You can use public IPv4 addresses to allow communication between ECS instances and the Internet. To allow an instance that is assigned a public IPv4 address to access the Internet, purchase public bandwidth for the instance.
ECS instances that are deployed in VPCs can be associated with static public IP addresses (public IP addresses that are automatically assigned) or elastic IP addresses (EIPs).
When you create an ECS instance, you can configure public bandwidth for the instance. This way, Alibaba Cloud can assign a public IPv4 address from the public IPv4 address pool to the instance. By default, Alibaba Cloud does not assign public IP addresses to ECS instances.
For an ECS instance that is created without a public IP address, you can increase the public bandwidth to a value greater than 0 Mbit/s when you change the instance configurations to automatically assign a public IPv4 address to the instance.
When an ECS instance is released, the static public IP address of the instance is returned to the public IPv4 address pool and is not retained for your use. In the following cases, the static public IP addresses of ECS instances may be released or reassigned:
If you set the public bandwidth of an ECS instance to 0 Mbit/s, the static public IP address of the instance is released. For information about how to modify the public bandwidth of ECS instances that use different billing methods, see Modify the public bandwidth configurations of an instance associated with an auto-assigned public IP address and Modify the public bandwidth configurations of an instance associated with an auto-assigned public IP address.
If you stop a pay-as-you-go ECS instance in economical mode, the static public IP address of the instance is released. When you restart the instance, a public IP address is automatically assigned to the instance. The assigned public IP address may be different from the released public IP address.
If you require a persistent public IPv4 address that can be assigned to or unassigned from ECS instances. For more information, see Convert the public IP address of an ECS instance in a VPC to an EIP.
An EIP is a public IP address that you can purchase and use as an independent resource. You can apply for an EIP or convert a static public IP address into an EIP. You can associate EIPs with and disassociate EIPs from ECS instances. Each ECS instance can be associated with multiple EIPs. For more information, see Associate an EIP with a secondary ENI. If EIPs are associated with ECS instances, the EIPs persist when the instances are released. For information about how to release EIPs, see Release a pay-as-you-go EIP. For information about how to use EIPs, see Overview.
IPv6 addresses
Alibaba Cloud VPC supports IPv6 addresses. After you enable the IPv6 addressing protocol, Alibaba Cloud assigns IPv6 CIDR blocks from the IPv6 address pool to VPCs. You cannot specify IPv6 CIDR blocks for VPCs. If a VPC supports IPv6 addresses, vSwitches that are created in the VPC support IPv6 CIDR blocks. You can specify an IPv6 CIDR block when you create a vSwitch in the VPC or enable IPv6 for an existing vSwitch in the VPC. For more information, see Create and manage a vSwitch. An IPv6 address that is assigned to an ECS instance must be within the IPv6 CIDR block of the vSwitch to which the instance is connected. The number of IPv6 addresses that can be assigned to each ENI on an ECS instance varies based on the instance type. For more information, see the IPv6 addresses per ENI columns in Overview of instance families.
IPv6 addresses are globally unique and can be configured to remain private or reachable over the Internet. To use IPv6 addresses to communicate with the Internet, you must enable IPv6 public bandwidth. For more information, see Step 3: Enable IPv6 public bandwidth.
If an ECS instance receives multiple IPv6 addresses when you create the instance, the IPv6 addresses are assigned to the primary ENI of the instance.
After you create an ECS instance, you can assign one or more IPv6 addresses to the instance.
After IPv6 addresses are assigned to the instance, you must log on to the instance to configure the IPv6 addresses in the operating system of the instance. For more information, see Use IPv6 addresses of Windows instances and Use IPv6 addresses of Linux instances. IPv6 addresses can be unassigned from ECS instances before the instances are released and reassigned to other ECS instances. After IPv6 addresses are assigned to ECS instances, you cannot modify the addresses. IPv6 addresses remain associated with ECS instances when the instances are stopped or started, and are released when the instances are released.
View the IP addresses of ECS instances
Go to the Instance Details tab of an ECS instance in the ECS console to view the IP addresses of the instance.
Log on to the ECS console.
In the left-side navigation pane, choose .
In the top navigation bar, select the region and resource group to which the resource belongs.
On the Instance page, find the ECS instance whose IP addresses you want to view and click the instance ID in the Instance ID/Name column. On the Instance Details tab, you can view the IP addresses of the instance.
IP addresses in the Configuration Information section:
Public IP Address: 47.98.XX.XX
EIP: 121.41.XX.XX
Primary Private IP Address: 192.168.XX.XX
IP addresses in the Associated Resources section:
Secondary Private IP Address: 192.168.XX.XX, 192.168.XX.XX
IPv6 Address: 2408:XXXX:325:a216:95f1:3dd9:6640:8b9e
NoteIf the ECS instance does not have a static public IP address, a secondary private IP address, an IPv6 address, or an EIP, the corresponding parameters are empty.