Sunday, 9 October 2011

Centos on VMWare II

Cloning a Centos 6 guest under VMWare Workstation 8 produces a network problem.  When the clone boots only the lo device will be active.   Running
service network status
will show that both lo and eth0 are configured but only the lo device is actually active.  The fix is to delete the file  /etc/udev/rules.d/70-persistent-net.rules and then reboot the guest.  When it comes back up the file you deleted will be automatically re-created and the network will be up and running as it should.

Edit: 21/10/2011

Sometimes this isn't enough.  When you reboot the server the network may not be running. If this this the case, login via the VMWare console and open these files in an editor:



Replace the "eth0" part of the ifcfg-eth0 with whatever the name of your network adaptor is. 

In the 70-persistent-net.rules  file there will be a line like this:

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:dc:25:e7", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

You may need to edit the part of the line that says "NAME="eth1" to reflect the name of your network adaptor.  Mine is eth0 but after I initially delete the 70-persistent-net.rules file the adapter name is changed to eth1 so I have to change it back again.

The second thing to do is ensure the ifcfg-eth0 file has the correct MAC address for the adapter.  It should be the same as the MAC address in the 70-persistent-net.rules file which is, in the example above "00:0c:29:dc:25:e7".

If the line
HWADDR=<Some MAC Address>
in your ifcfg-eth0 file  has a different MAC address, replace it with the one from the 0-persistent-net.rules file. 

Reboot and everything should be working this time.