Cloning a VirtualBox machine running CentOS causes network interfaces to fail
When you clone a VirtualBox machine in order to create a new virtual machine (as opposed to creating a back up of an existing machine) then you must check Reinitialize the MAC address of all network cards and use the Full clone type to make sure that the original and the clone don’t share any resources.
After booting the new (freshly) cloned machine you will notice that all the network interfaces are down. Trying to raise them gives you the following:
[root@myhost ~]# ifup eth0 Device eth0 does not seem to be present, delaying initialization. [root@myhost ~]# ifup eth1 /sbin/ifup: configuration for eth1 not found. Usage: ifup <device name>When Linux boots the clone image for the first time it sees the new MAC address. It compares it with the MAC address it has saved for
eth0
and realises that they are different. In order to avoid a conflict (in case the old network card comes back), Linux creates a new interface called eth1
.
We are running VirtualBox (2.4.6) and don’t have network cards in the virtual machine. We just want it to be the same as the original machine without a lot of faff.
- Edit the NIC cache:
vi /etc/udev/rules.d/70-persistent-net.rules
- Delete the line where NAME="eth0″
- Find the line with NAME="eth1″ and change eth1 to eth0
- Save file
- Edit the new interface file:
vi /etc/sysconfig/network-scripts/ifcfg-eth0
- Strip out everything but the bare minimum:
DEVICE="eth0″ BOOTPROTO="dhcp” ONBOOT="yes”
- Save file, then reboot:
reboot
3 comments
Comment from: george [Visitor]
Thanks a ton !
this solution was simple. I wasted much time till I got here.
Comment from: Rodrigo Ferraz [Visitor]
Man, this was great! Thank you so much
Comment from: Naveen [Visitor]
Worked like a charm. Thanks.
Form is loading...