Fix broken networking after VM Cloning


If you manage VM, you maybe have this kind of situation.

I need to clone one of my VM for many reasons. Maybe because I just want to set one VM and then clone for other cluster VM. Or I need to clone it to another cluster to see whether there is something wrong with the original cluster disk.

So maybe you found your networking broken. So from I learned,

if you clone CentOS installed VM, then in your new CentOS cloned VM you need to do one of these.

Option 1 :

If your original VM has one interface, eth0. Then you can just change the name of interfaces to another number. For example you can change the interface name in the new one with eth1.

Another case is if your original VM has two interfaces (eth0 and eth1), then in your new ones, you can change both interface into, for example, eth2 and eth3.

Do not forget to change the ifcfg-eth0, etc to the appropriate name(s). Then lastly, you need to restart your network service (/etc/init.d/network restart)

Option 2 : Remove or comment the persistence rules.

This is for CentOS :

To get the same interface and ip-address of your “old” vm you have to do the following:

vim /etc/udev/rules.d/70-persistent-net.rules

Now you can remove all the lines with beginning of “SUBSYSTEM…”.
Now reboot the machine, the new Interface and MAC-Address will newly detected by udev and we have a clean new eth0 device.
The file locks as example like this:

# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

# PCI device 0x8086:0x100f (e1000) (custom name provided by external tool)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:ab:9d:11:13", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

This is for Ubuntu :

There are udev rules preventing the new interface from being brought up.

In the Master machine, just delete them before you clone the new machines:

sudo rm -f /etc/udev/rules.d/70-persistent-net.rules

Explanation (my own analysis though) :

When you create VM, vsphere or vcenter is automatically generate your MAC Address for your VM, then when you clone it, its MAC Address is being regenerated. So that it’s prevented that two VMs has the same interfaces. So either you remove the persistence rules or you can change the interface number to other than the original


Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:


You are commenting using your account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s