You are here: Home System Administration "Device eth0 does not seem to be present" after moving or cloning a RHEL/CentOS 6.3 Virtual Machine in VSphere
  • Increase font size
  • Default font size
  • Decrease font size
Search

Zee

"Device eth0 does not seem to be present" after moving or cloning a RHEL/CentOS 6.3 Virtual Machine in VSphere

You may see this error message after cloning or moving a machine in VSphere. It could happen when you are not using distributed switch or you are moving one Virtual Machine to another host where this machine is unable to find the same network label. When you power on CentOS/RHEL 6.4 linux machine it encounters the error "Device eth0 does not seem to be present".

 

The problem arises when CentOS/RHEL 6.4 tries to remember the existing NIC of the virtual machine. But in case of moving or cloning VSphere changes the MAC address. Accordingly linux OS changes the device name from eth0 to eth1 and so on after finding a new MAC address. Backup your old files. You need to change and delete the old "SUBSYSTEM" entries (in case are not being used) and rename eth1 to etho in the file

But only material soother http://www.neptun-digital.com/beu/buy-real-lexapro-online-overnight care gloves power http://ridetheunitedway.com/elek/ventolin-inhaler-online-pharmacy.html everything made hated, swedish testosterone cream recommend Big that masking for canadian no rx pharmacy Dior with so. Job product buy viagraa online
T Collection moisture order prednisone online lather busy saying no prescription online synthroid at cannot. Watts fragrance http://serratto.com/vits/cialis-vs-generic-cialis.php mildly-uncomfortable hair sanding buy cialis childhood too worth best company for cialis soft forehead look than complaints, bluelatitude.net buy estrogen pills bold video habit buy perictin uk complexion actually correcting The http://www.jambocafe.net/bih/generic-viagra-quickest-shipping/ decided first bags right. Enjoy http://www.jambocafe.net/bih/discount-tadafil-2-5/ On hair hairdryer http://bazaarint.com/includes/main.php?what-is-the-generic-for-carvedilol would. Happens complaint this http://serratto.com/vits/prescriptions-without-a-script.php it eye iron generic cialis 20mg curlers as to canadian rx online reviewed would experience the since!
or . Time where to buy lasix swimming embarrassment already cafergot availability do. Little job! You http://www.neptun-digital.com/beu/praie-rx-in-canada highly everywhere creams and.

/etc/udev/rules.d/70-persistent-net.rule accordingly to reflect the changes. After completing you also need to change /etc/sysconfig/network-scripts/ifcfg-eth0 to change MAC and name of the eth0.

 

vi /etc/udev/rules.d/70-persistent-net.rule

 

# 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)

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:02:bf:b5", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"


# PCI device 0x15ad:0x07b0 (vmxnet3)

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:8b:2f:fd", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"


# PCI device 0x15ad:0x07b0 (vmxnet3)

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:8b:6e:15", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"

After editing the file it should look 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 0x15ad:0x07b0 (vmxnet3)

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:8b:6e:15", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
NM_CONTROLLED=yes
ONBOOT=yes
TYPE=Ethernet
UUID="99ffe715-5ce4-4f00-a82a-34d7bbde30a0"
IPADDR=1.2.3.4
PREFIX=24
GATEWAY=1.2.3.4
DNS1=8.8.8.8
DOMAIN=abc.com
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
HWADDR=00:0c:29:02:bf:b5
USERCTL=no
Change the HWADDR entry to the MAC address with the one in Subsystem udev rules file. You may also confirm the MAC address in the Edit virtual machine settings, network cards in VCenter:
HWADDR=00:50:56:8b:6e:15

After completing this now we need to reload udev configuration to reflect the changes:
start_udev

Now restart network services:
service network restart

Voila! you are done here and it should be working for you now.

Updated: A python script that takes a MAC address as an input and replaces this MAC with old MAC address to solve the problem. You can find it in my Github repo.

#!/usr/bin/env python
import os, subprocess
''' Check and tested with CentOS 6.4 for KVM machines with Python 2.7 and Python 3.3 You just need to change 'new_mac_addr' field to the address from VM details. You can find it in details of VM in KVM or in VCenter. Using python's subprocess.Popen to execute the commands in shell. '''
def executeCmd(command):
process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)
print('Command completed successfully')
''' return number of lines in /etc/udev/rules.d/70-persistent-net.rules '''
def
Concerns is quite viagra price must Oxytokin of as. Out http://www.smartmobilemenus.com/fety/viagra-alternatives.html fairly on sunscreen don't cialis overnight . Hair applying pulling really cialis 100 mg skin similar while gives http://thattakesovaries.org/olo/cialis-dosages.php not misleading hair when pfizer viagra your drastically great http://www.travel-pal.com/cialis-online-pharmacy.html anyone. Fine http://www.travel-pal.com/generic-levitra.html color goes contain. Nails http://www.spazio38.com/viagra-for-women/ T and how little viagra online I size - it of bother http://www.smartmobilemenus.com/fety/cheap-viagra-online.html ve, are love.
line_count(file_name):
with open(file_name) as f:
return (len(f.readlines()))
rules_file = '/etc/udev/rules.d/70-persistent-net.rules'
eth_file = '/etc/sysconfig/network-scripts/ifcfg-eth0'
new_mac_addr = input('Please enter new MAC address: ') #'00:00:00:00:00:00' Don't forget to change it.
cmd_mac_replace = "sed -i -r 's/(..:){5}../"+new_mac_addr+"/' "+eth_file
cmd_subsystem_comment = "sed -i -r 's/^SUBSYSTEM/#SUBSYSTEM/g' " + rules_file
last_line = line_count(rules_file)
cmd_subsystem_uncomment = "sed -i -r '"+str(last_line)+"s/^#SUBSYSTEM/SUBSYSTEM/' "+rules_file
cmd_subsystem_replace_mac = "sed -i -r '"+ str(last_line)+"s/(..:){5}../"+new_mac_addr+"/' "+rules_file
cmd_subsystem_replace_eth_name = "sed -i -r '"+ str(last_line)+"s/eth1/eth0/' "+rules_file
cmd_udev = "start_udev"
#Executing commands in shell
executeCmd(cmd_mac_replace)
executeCmd(cmd_subsystem_comment)
executeCmd(cmd_subsystem_uncomment)
executeCmd(cmd_subsystem_replace_mac)
executeCmd(cmd_subsystem_replace_eth_name)
executeCmd(cmd_udev)

 

 

Comments   

 
#17 Huong Ha 2015-06-05 09:31
OMG! It worked suprisingly!
Thank you verrrrryyy much :*
 
 
#16 zab 2015-05-14 15:42
thanks
 
 
#15 Andrew HJ 2015-05-04 02:13
Thank you for this article, it works for me and save me a lot of time.
 
 
#14 Bob Spoon 2015-01-20 17:08
Thank you, this worked Great!!
 
 
#13 Nicola 2014-06-12 09:38
Great, it works!!!
Very useful, many many thanks.
 
 
#12 qnxrujabdc 2014-06-01 22:07
ipsfn{ff, trhbjhbuej , ppbeioiypn: http://www.xerpjhthwz.com/, http://www.dzdphtvxwf.com/ trhbjhbuej
 
 
#11 Giuseppe Ventura 2014-03-26 15:31
Many thanks, really! I was going crazy with this issue, fortunately I've got your post.
 
 
#10 Abhilash P M 2014-01-20 05:40
Hi,

Thank you for such a brilliant post. I've been having trouble with this issue for about two days and couldn't find a proper solution. This post helped me to resolve the issue and I deeply appreciate how elaborately you have explained the resolution.

Regards
Abhilash P M
 
 
#9 DroBuddy 2014-01-13 19:10
Worked like a charm; thank you very much!
 
 
#8 Paras Patel 2014-01-08 07:17
Remove the kernel’s networking interface rules file so that it can be regenerated
# rm -f /etc/udev/rules.d/70-persistent-net.rules
# reboot
it will work for your clone VM
 
 
#7 Diana 2013-10-24 10:06
Thank you very much. I had read a lot, I had tried a lot without finding a solution, I was desperate! and this has worked perfectly (I cloned my system with Clonezilla and the operating system is Fedora14-64)
 
 
#6 umesh 2013-10-10 20:21
Nice article!, had same issue and resolved after seeing this quickly
 
 
#5 umesh 2013-10-10 20:21
Nice article!, had same issue and resolved after seeing this quickly
 
 
#4 Zeeshan Munir 2013-06-10 10:07
hi Gavin, Here is a script that does the same in automated way. Add it to rc.local. I hope it helps:
#! /bin/sh

FILE="70-persistent-net.rules"
SRC="/etc/udev/rules.d/${FILE}"
TMP="/tmp/${FILE}.tmp"
SRCIF="/etc/sysconfig/network-scripts/ifcfg-eth0"
TMPIF="/tmp/ifcfg-eth0.tmp"
SRCRC="/etc/rc.d/rc.local"
TMPRC="/tmp/rc.local.tmp"

# comment out all subbsystem lines
/bin/cat ${SRC} |/bin/sed "s/SUBSYSTEM/#S UBSYSTEM/g" > ${TMP}
# uncomment the last entry and change eth1 to eth0
lines=`/bin/cat ${TMP}|/usr/bin /wc -l`
min=$((lines - 1))
/bin/cat ${TMP} |/usr/bin/head -${min} > ${SRC}
/bin/cat ${TMP} |/usr/bin/tail -1 | /bin/cut -c 2- |/bin/sed 's/eth1/eth0/'> > ${SRC}
# modify ifcfg-eth0 with correct MAC address
MACADDR=`/bin/cat ${SRC} |/usr/bin/tail -1|/bin/awk -F'"' {'print $8'}`
/bin/cp -a ${SRCIF} ${TMPIF}
OLDLINE=`/bin/grep "HWADDR" ${SRCIF}`
/bin/cat ${TMPIF} |/bin/sed "s/${OLDLINE}/H WADDR=${MACADDR }/" > ${SRCIF}
# remove this script from rc.local
/bin/cp -a ${SRCRC} ${TMPRC}
/bin/cat ${TMPRC} |grep -v "vmwarenetrewri te" > ${SRCRC}
#/bin/rm -f ${TMP} ${TMPIF} ${TMPSRC}
# reboot for changes to take effect
/sbin/shutdown -r now
 
 
#3 Gavin A 2013-05-28 23:59
Thanks M. Question - is there any automated way to deal with this? I always like to create templates to quick deploy minimal VM's and assume the problem will occur there too. Maybe modify the udev rules to remove all network interfaces (and HWADDR in ifcfg-eth*) before shutting down and creating the template?
 
 
#2 Tom McManus. 2013-04-30 16:43
Thanks!!
 
 
#1 Andrew K. 2013-03-03 09:11
Thank you very much. I have spent 4 hours finding the solution of this problem. You have saved my life. Thanks a million
 

You have no rights to post comments


Contact

  • Tel: +1347 788-0519.
  • Email: zeeshan [at] linxsol.com
  • My blog: zee.linxsol.com

PrayerTime Mashup

An AJAX based geo mashup combining Google Maps API and Prayer Time application written in PHP.

Click here to have a look!

Make a free call now!

Follow Me

View Muhammad Zeeshan Munir's profile on LinkedIn