Why Cannot I Use DHCP to Obtain a Private IP Address?
Symptom
DHCP cannot be used to obtain a private IP address. The symptom varies based on the OS.
- For Linux, a private IP address cannot be assigned.
- For Windows, a private IP address is changed to an IP address in the 169.254 network segment, which is different from the private IP address displayed on the ECS console.
Solution
- Check whether dhclient is running in the ECS.
- Log in to the ECS and run the following command:
ps -ef | grep dhclient
- If the process is not running, log in to the ECS, and restart the ECS NIC or initiate a DHCP request.
- Log in to the ECS and run the following command:
- Handle the issue if the DHCP client fails to work for a long time (for example, the issue recurs after the NIC is restarted).
- Configure a static IP address.
- Windows
- Right-click Local Area Connection and choose Properties from the shortcut menu.
- In the displayed dialog box, select Internet Protocol Version 4 (TCP/IPv4), click Properties, and modify parameter settings.

- Linux
- Log in to the ECS and run the following command to modify parameter settings:
vi /etc/sysconfig/network-scripts/ifcfg-eth0
BOOTPROTO=static IPADDR=192.168.1.100 #IP address (modified) NETMASK=255.255.255.0 #Mask (modified) GATEWAY=192.168.1.1 #Gateway IP address (modified)
- Run the following command to restart the network:
- Log in to the ECS and run the following command to modify parameter settings:
2. Select an image in which DHCP runs stably.- Native Windows series, such as Windows Web Server 2008 R2 64bit, Windows Server DataCenter 2008 R2 64bit, Windows Server Enterprise 2008 SP2 64bit, or Windows Server Enterprise 2008 R2 64bit
- CentOS series, requiring you to add PERSISTENT_DHCLIENT="y" in /etc/sysconfig/network-scripts/ifcfg-ethX
- Ubuntu series, such as Ubuntu 1004
- If the fault persists, obtain the messages in /var/log/messages on the affected ECS, use the MAC address of the affected NIC to filter the desired log, and check whether there is any process preventing DHCP from obtaining an IP address.
- If the fault persists, contact customer service for technical support.

Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.