Skip to content
Home » Linux » How to Resolve Network Problem After Cloning a Linux VM

How to Resolve Network Problem After Cloning a Linux VM

When you clone a Linux VM from a snapshot of another VM, VMware will generate another MAC address for the new VM, but when the new VM startup, it cannot find a correct configuration and fails to start network service. If you restart the network service, the console will show an error message:
"device eth2 does not seem to be present delaying initialization"
If you have ever installed desktop environment in your VM, like GNOME, the problem will be small, you can use "Network" utility to detect the right MAC address, the save and restart network service, but if you don't have desktop environment, you can also overcome the problem, just with a little tricky.

Here are the steps to solve the problem.
  1. Check network cards' configuration.
  2. # cd /etc/sysconfig/network-scripts/
    # ls -l ifcfg-eth*
    -rw-r--r-- 1 root root 216 Sep  1  2011 ifcfg-eth2

    Found eth2, it's not the original eth0.
  3. Check the content of configuration files
  4. # cat ifcfg-eth2
    # Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)
    DEVICE=eth2
    BOOTPROTO=static
    BROADCAST=192.168.0.255
    HWADDR=00:0C:29:35:CA:90
    IPADDR=192.168.0.188
    NETMASK=255.255.255.0
    NETWORK=192.168.0.0
    ONBOOT=yes

    Found HWADDR is wrong.
  5. Check what NIC the kernel captures
  6. # cat /proc/net/dev | grep eth
    eth3...

    The result shows what NIC the kernel captures, in this case, eth3 is captured.
  7. Check the network devices rule file and look for an entry named "eth3".
  8. # cd /etc/udev/rules.d
    # vi 70-persistent-net.rules
    ...
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:33:b9:72", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3"
    ...

    Found an entry named "eth3", and I believe this MAC is the right one.
  9. Change the "eth3" into "eth0" in this entry, and comment out all other entries.
  10. ...
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:33:b9:72", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
    ...

  11. Move ifcfg-eth2 to ifcfg-eth0 and change DEVICE into "eth0" and change HWADDR into the correct MAC address.
  12. # mv ifcfg-eth2 ifcfg-eth0
    # vi ifcfg-eth0
    DEVICE=eth0
    BOOTPROTO=static
    BROADCAST=192.168.0.255
    HWADDR=00:0C:29:35:B9:72
    IPADDR=192.168.0.188
    NETMASK=255.255.255.0
    NETWORK=192.168.0.0
    ONBOOT=yes

  13. Restart the server.
  14. # shutdown -r now
The network service is back to normal.

Leave a Reply

Your email address will not be published. Required fields are marked *