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.
Second step, boot the VM. Login as root and CD to: /etc/udev/rules.d.
Edit file: 70-persistent-net.rules.
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”.
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”.
Edit file: /etc/sysconfig/network.
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?
That’s all, thank you for reading.