The other day, I encountered with a strange error after I cloned a CentOS 6 guest machine in Oracle VirtualBox. After logging in to the CentOS guest, I noticed that the network card is disappeared. I can't SSH into the CentOS guest anymore.
I checked the IP address using command:
lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
As you see in the above output, the eth0 config details is not displayed. It only shows the details of the loopback interface.
I tried to restart the network service to sort out the issue.
# service network restart
Nothing! It simply displayed the following error.
Bringing up interface eth0: Device eth0 does not seem to be present, delaying initialization
I thought that there could be any misconfiguration in network configuration file. So, I decided to look into the eth0 configuration file to make sure if everything is correct.
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0 BOOTPROTO=none DEVICE=eth0 GATEWAY=192.168.1.1 HWADDR=08:00:27:DC:33:3F IPADDR=192.168.1.150 NETMASK=255.255.255.0 NM_CONTROLLED=no ONBOOT=yes TYPE=Ethernet USERCTL=no
Everything seems OK.
Again, I tried to bring Network card up using command:
# ifup eth0
But, still no luck! It keeps showing the same error message as shown below.
Device eth0 does not seem to be present, delaying initialisation
I added an additional virtual network interface card and configured it. I restarted network service and CentOS guest several times. But, nothing helped. I keep getting the same error over and over.
After a bit searching on web, I found the solution. The MAC address is the problem! After cloning the CentOS VM, the CentOS guest was still using the old machine's MAC address in the Virtual machine settings.
Solve "Device eth0 does not seem to be present, delaying initialization" error
If you ever encountered with the same issue, you can fix it as described in the following two methods.
To fix this problem, simply remove the file
/etc/udev/rules.d/70-persistent-net.rules and reboot your system.
# rm /etc/udev/rules.d/70-persistent-net.rules
Now, you will see the network card is up.
If the problem is still not solved, open up the eth0 config file:
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
Note down the MAC id (HWADDR).
[...] HWADDR=08:00:27:DC:33:3F [...]
Close the file. Then, power off the CentOS guest and go to Settings -> Network -> Adapter 1 -> Advanced from VirtualBox menu bar.
Replace the old MAC id and update it with new one.
After changing the MAC address, Click OK to save it. and power on your guest.
Now, Check if the network card is up using command:
That's it. It worked!
great article buddy. thanks man
Thank you! The MAC address not matching what I had in the Virtual Box settings was the problem.
Thank you brother. This is really informative and this doc helped me to resolve my issues in the real network.
Nice summary! Thanks. note: it’s 70-persistent-net.rules not 70-persistant-net.rules
thanks dude for this information.
helping me so much
Thank you. it solved my problem.
Thank you – after cloning, I commented out the mac address in ifcfg-eth0, but apparently that wasn’t enough, I had to insert the correct mac, and there it worked.
Thanks, really hopeful ! sincere appreciation from inside of the Great Wall haha
It’s works, thanks a lots 🙂
Thank you ! You saved me hours of work!
Glad I could help.
that was very helpful and great. thanks a lot
Worked like a champ for me..thanks
works fine thanks
thank you so much.. removing the 70-persistent-net.rules worked for me.
Excellent! It was really helpful. Keep up the good work.
Hi, You have saved my life! I spent many days trying to solve it…
Thank you very much!!!
thanks for sharing great articles
This issue has plagued me for years. Thanks for posting. It was a great help. +1 Brother! Glad I found your post.
Hours of searching and I came across this fantastic article, only wish I had found it sooner, THANK YOU!
Perfect. Removing that file was all I needed to do. Now my VM is on the network.
My pleasure. Glad you fixed it.
Its work! Thank you!
Great Article, Clean and On the spot. Thanks Mate
Thanks a lot.. it’s very useful
Thanks, you are awesome!!
Thanks a lot.. removing the 70-persistent-net.rules worked for me.
It was a great article.
HELLO HUMAN The second method, worked just fine THANKS
Thanks! This helped me through the first time I cloned a linux VM. May I suggest a small change in your solution? Editing the VMware settings to match the VM’s eth0 MAC will make your VMware environment have a duplicate MAC. Instead, what I did was simply checking the new MAC value from the vCenter console, and put that into the cloned VM’s ifcfg-eth0 file. This worked too.
Thanks. I never knew it.
“rm /etc/udev/rules.d/70-persistent-net.rules” –> That’s THE trick!
Glad It helped. Regards.
May I recommend editing ifcfg-ethx to change the MAC address to match VMware’s generated address instead of the other way around. This helps avoid having a duplicate MAC in your VMware infrastructure if you were to use vCenter to clone a VM.
Thank you so much, It worked with the last solution.
Very good. helped me alot
many thanks, great article!