See for more hot deals...
See for more hot deals...

I did a fresh install of CentOS 6 as a VMware client on vSphere 4.1 and turned it into a template for future installs. Cloning it from the template creates a pristine image i can use anytime i need a freshly installed CentOS 6 client.  The problem with this is every new client i deploy from the template image has networking issues where the primary networking device is not a valid interface.  When i run an ifconfig -a it shows “eth1″ and “lo” when it should be showing “eth0″ and “lo” like the original templated client does.  If i try to restart networking by doing a “service network restart” i get the “Device eth0 Does Not Seem To Be Present, delaying initialization”.

In this particular version of Linux there is something called “udev” that remembers the networking interfaces from the cloned machine when the new one is deployed.  See the output from my “/etc/udev/rules.d/70-persistent-net.rules" file:

$ more /etc/udev/rules.d/70-persistent-net.rules
# 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 0x15ad:0x07b0 (vmxnet3) (custom name provided by external tool)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:92:00:07", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

As you can see in my /etc/udev/rules.d/70-persistent-net.rules file it specifies a mac address and interface name for both eth0 and eth1.  To fix the problem go back into vCenter server and check the settings of the NIC. Under the virtual machine properties you can see what the MAC address is of the virtual NIC.  In this particular case its "00:50:56:92:00:25".  After you verify the NIC in vCenter Server log back into the client and check the /etc/sysconfig/network-scripts/ to make sure the file “ifcfg-eth0″ is there with the correct MAC address as in your “/etc/udev/rules.d/70-persistent-net.rules" for eth0.
[root@localhost ~]# more /etc/sysconfig/network-scripts/ifcfg-eth0

Once you have the MAC address matching in all three locations (/etc/sysconfig/network-scripts/ifcfg-eth0 , /etc/udev/rules.d/70-persistent-net.rules, and the network settings for the virtual machine) reboot the system and networking should be restored on eth0.  Hope that helps!