Virtual Machines

Products

Virtual Machines

Documentation > Products > Virtual Machines > Solution for Failure to Obtain Private IP After Creation of Virtual Machines Using centos Private Image.

Solution for Failure to Obtain Private IP After Creation of Virtual Machines Using centos Private Image.

Sometimes, after creating a Virtual Machines using the previously created centos private image, it is found that the Virtual Machines does not obtain the private IP. Ifconfig -a checks the network information and finds that the network card interface name is changed into eth1 and there is no private IP information, as shown in the figure:

This is because the UUID information of the network card interface was retained when the private image was created. When the Virtual Machines was created using the private image, the system automatically assigned the network card interface to eth1, and there is no ifcfg-eth1 configuration file under /etc/sysconfig/network-scripts (but only original ifcfg-eth0 file). As a results, there was eth0 configuration file in the system but the eth0 device could not be found and there was eth1 device but no eth0 configuration file, so the private IP could not be obtained and accessed.

Solution:

Execute vi /etc/udev/rules.d/70-persistent-net.rules

As shown in the figure:

You can see that the system automatically generates the content of eth1 (yellow box) under the content of the original eth0 network card interface (red box).

Modify the file, comment out the content of eth0, and change the device name in the eth1 content into eth0. As shown in the two red boxes below, wq saves the file and exits.

Reboot the Virtual Machines. After rebooting, execute ifconfig -a and find that the previous eth1 device name retored to eth0 and the private IP can be obtained and can be accessed normally after associating EIP.

If your problem still can not solved, please submit open ticket to us.

Update Time:2019-08-28 21:38:32