IP address management FAQ
Get and query IP addresses
-
How do I view the internal network gateway IP information of an ECS instance?
-
Are public and private IP addresses independent? Can I specify or add IP addresses?
Change IP addresses
-
Can I change the public IPv4 address after creating an instance?
-
How do I replace an instance's static public IP with another EIP?
-
Besides changing the public IP address, can I also change the private IP address?
-
Why don't I see the option to change the public IP in the ECS console?
-
What are the limits for transferring an ECS instance and changing its public IP address?
-
Can I detach the primary ENI of an ECS instance and attach it to another ECS instance?
IP protocols and other topics
-
How do I disable the public network interface of an ECS instance?
-
How do I block access from specific regions or outside China?
Appendix
Are public and private IP addresses independent? Can I specify or add IP addresses?
Public IP addresses map to private IP addresses using NAT. You can specify secondary private IP addresses or add IP addresses using multiple IP configurations.
How do I replace an instance's static public IP with another EIP?
If you selected fixed bandwidth when purchasing your Elastic Compute Service instance and have already purchased a new EIP, follow these steps:
-
Method 1
-
Convert fixed bandwidth to pay-as-you-go bandwidth. For more information, see Public bandwidth billing.
-
Convert the static public IP to an EIP. For more information, see Convert a static public IP of a VPC-type ECS instance to an EIP.
-
Detach the converted EIP. For more information, see Detach an EIP.
-
Attach the new EIP. For more information, see Associate with an ECS instance.
-
-
Method 2:
In the OOS console, use the
ACS-ECS-ConvertsPublicIPToNewEIPByInstanceIdO&M template to convert an instance's public IP to another EIP. For the China (Hangzhou) region, go to ACS-ECS-ConvertsPublicIPToNewEIPByInstanceId. After clicking the link, you can change the region in the menu bar at the top of the OOS console.
What are the limits for transferring an ECS instance and changing its public IP address?
Transferring an ECS instance and changing its public IP address are subject to the following limits:
-
Public IPs and EIPs cannot be transferred across accounts.
-
If an instance has no public IP assigned, you can bind an EIP to it. Bind a new EIP to change the public IP.
-
If an instance already has a public IP assigned:
-
You can change the public IP address up to three times within six hours after instance creation. For more information, see Change public IP address.
-
Change the IP by converting the public IP to an EIP. For more information, see Convert static public IP to EIP.
-
How do I query the IP address of an ECS instance?
-
Linux instances
Use
ifconfigto view NIC information. You can see the IP address, subnet mask, gateway, DNS, MAC address, and other details. -
Windows instances
In a command window, use
ipconfig /allto view NIC information. You can see the IP address, subnet mask, gateway, DNS, MAC address, and other details.
For more information, see IP addresses.
How do I disable the public network interface of an ECS instance?
-
Linux instances
-
Use
ifconfigto check the NIC name of the ECS instance. -
Use
ifdownto disable the NIC. If the NIC name iseth1, runifdown eth1.NoteYou can also use the ifup command to re-enable the NIC. If the NIC name is
eth1, runifup eth1.
-
-
Windows instances
-
In a command window, use
ipconfigto view NIC information. -
Open and disable the NIC.
-
How do I configure an IPv6 address for an ECS instance?
For more information, see IPv6 communication.
Can I change the public IPv4 address after creating an instance?
You can change the public IP address within six hours after instance creation. For detailed steps, see Change public IP address.
After six hours, the options depend on the instance's network type.
You can convert the public IP to an EIP. For detailed steps, see Convert static public IP to EIP.
Why don't I see the option to change the public IP in the ECS console?
-
Within six hours after instance creation: You can directly Change Public IP Address in the console.
-
More than six hours after instance creation: Changing the public IP address directly is not supported, so the Change Public IP Address option does not appear.
For more information, see Static public IP.
Besides changing the public IP address, can I also change the private IP address?
Yes. For detailed steps, see Primary private IP address.
If no public IPv4 address was assigned when creating an instance, how can I obtain a public IP address after the instance is created?
-
Request and associate an EIP. For more information, see Request an EIP.
-
Change the instance's public bandwidth to assign a static public IP address. For subscription instances, see Overview of upgrade and downgrade methods. For pay-as-you-go instances, see Modify bandwidth for pay-as-you-go instances.
How do I view resource quotas?
To view usage limits and quotas for resources, see Limits.
How do I block access from specific regions or outside China?
ECS security groups support access control rules based only on IP addresses or CIDR blocks, not by geographic region. To block access by region, choose one of the following solutions based on your service type:
-
Web services: Use Web Application Firewall (WAF) and enable geo-blocking to deny access from specific regions.
-
Non-web services: Use the region selection feature of Configure traffic control policies for internal network access to the Internet.
Can I detach the primary ENI of an ECS instance and attach it to another ECS instance?
You cannot detach the primary ENI of an ECS instance and attach it to another instance without releasing the original instance.
To assign the primary ENI's private IP to another ECS instance without releasing the original instance, follow these steps:
-
Stop the source instance that holds the private IP.
-
Change the private IP of the source instance's primary ENI to another unused IP in the same CIDR block to release the original IP.
-
Stop the destination instance.
-
Set the private IP of the destination instance's primary ENI to the original instance's private IP.
Releasing an ECS instance deletes its associated ENIs by default. You can choose to retain ENIs when releasing an instance and attach them to a new instance. For more information, see Retain ENIs when releasing an instance.