Posts tagged Linux

Cloned From Template CentOS or RedHat Client on VMware and “Device eth0 Does Not Seem To Be Present” error message

0

See Hotdealr.com for more hot deals...
See HowIFixedIt.com/hotdeals 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
DEVICE=”eth0″
BOOTPROTO=”dhcp”
HWADDR=”00:50:56:92:00:07″
IPV6INIT=”yes”
IPV6_AUTOCONF=”yes”
NM_CONTROLLED=”yes”
ONBOOT=”yes”

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!

Using TAR To Archive A Directory

1

Was looking for a way to tar backup a directory on my webserver.

Here is the command:


See Hotdealr.com for more hot deals...
See HowIFixedIt.com/hotdeals for more hot deals...

tar -cvzf /directory/where/you/want/the/backup/to/go/filename.$(date +%Y-%m-%d).tgz /directoy/you/want/to/tar

Here is what this command is doing:

  • c — to create a tar file, writing the file starts at the beginning.
  • f — specifies the filename (which follows the f) used to tar into or to tar out from
  • z — use zip/gzip to compress the tar file or to read from a compressed tar file.
  • v — verbose output, show, e.g., during create or extract, the files being stored into or restored from the tar file.

/directory/where/you/want/the/backup/to/go/ is the directory the tar file will reside after the command is run.

filename.$(date +%Y-%m-%d).tgz is the filename of the file you just archived.  It will append the year, month, and day to the file So your file will look like this: filename.2010-03-05.tgz

/directoy/you/want/to/tar is the directory including all sub directories that will be archived.

To see more info about tar run “man tar” in your terminal.

Go to Top