CentOS Clone with Fixed IP fails

After booting  a cloned CentOS 6.x (or equivalent Red Hat), you will notice that eth0 is missing and the only available adapter is the loopback interface.

Based on this excellent post (Thank you very much Alex!), a quick write-up for my own convenience, the complete overview for fixing this issue, changing the IP address and the hostname.

First step, note the new MAC Address for the network adapter. As a result of cloning a VM, MAC addresses will change.

CentOSClone-01Figure 1

Second step, boot the VM. Login as root and CD to: /etc/udev/rules.d.

Edit file:  70-persistent-net.rules.

CentOSClone-02Figure 2

The first entry is the old network adapter, with NAME= “eth0”. The second entry is the adapter with the correct MAC address and NAME=”eth1”.

Remove the first entry with the old MAC. Now edit the correct entry and change the name from “eth1” to “eth0”.

CentOSClone-03Figure 3

Third step, we need to change the description of eth0.
Edit file: /etc/sysconfig/network-scripts/ifcfg-eth0.

Edit the line starting with “HWADDR” and fill in the correct MAC address. If the cloned VM needs a new fixed IP address, edit the line starting with “IPADDR”.

CentOSClone-04Figure 4

Edit file: /etc/sysconfig/network.

CentOSClone-05Figure 5

If the cloned VM needs a new hostname, change the line starting with “HOSTNAME”.

If you have edited the IP address, check the gateway address and if necessary adjust the line starting with “GATEWAY”.

It is also a good idea to check the /etc/hosts file and in case DNS resolving has changed, also check the /etc/resolv.conf file.

Final step, reboot the VM. After reboot, login and check the results.

  • Is the hostname correct?
  • If you changed the IP address, check the new address.
  • Try to ping the default gateway.
  • Does DNS resolving work?
  • Etc.

CentOSClone-06Figure 6

That’s all, thank you for reading.

3 Responses to CentOS Clone with Fixed IP fails

  1. nikitux says:

    Hi you can also use sys-unconfig command which provides a simple method of reconfiguring a system in a new environment. Upon executing sys-unconfig will halt your system, and run the following configuration programs at boot:

    Change the root password.
    Reconfigure networking / routing.
    Reconfigure time / date / time zone etc.
    Reconfigure Keyboard and mapping.
    Reconfigure system authentication resources.
    Reconfigure system runlevel.
    Reconfigure system services.
    Type the following command as root user. Warning: do not type the following command on a production server for just testing purpose. The system will go down immediately:
    # sys-unconfig

    This command will create a file called /.unconfigured. The presence of this file will cause /etc/rc.d/rc.sysinit to run the programs mentioned above. Also, all persistent rules will be deleted from /etc/udev/rules.d/.


  2. Manoj Nair says:


    I tried the process given here https://paulgrevink.wordpress.com/2013/11/24/centos-clone-with-fixed-ip-fails/.
    This did not work s my VM which is a Centos 6.4 32 bit version kept taking a DHCP. So as workaround what I did this – configured a static entry in DHCP for the MAC address and the IP is stable now after multiple reboots.

    I just tried out the post suggested by Paul above nad that also does not do hte job
    It just reconfigures the system keyboard settings etc not network

    I ran the setup command and changed the IP setting to DHCP and rebooted the machine and then tried setting it back to manula IP mode . Did not work.

    Im using Centos 6.4 32bit on Vmware 5.0

    Similar processes are explained in VmWare knowledgebsae but does not work

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: