Fix missing network cards after moving a Virtual Machine (CentOS/RHEL)

So you have been busy working up a nice working virtual machine in your dev environment and now you want to move it into production, or you have built a VM for a friend to show them something and when you send it over to them, the bloody thing doesn’t work. Normally, the most common complaint is when I start my virtual machine I don’t see eth0 (or any network cards for that matter)

This is down to the way virtual machines work. When you create a virtual machine your hypervisor (Hyper-V/VMware/Virtualbox etc) generates a new MAC address for your network card, when you install your OS, the setup program grabs this information and stores it in a couple of files. This allows the OS to understand which device is which.

Now when you clone/export a VM and then import it into another hypervisor instance, the new hypervisor generates a NEW MAC address, but doesn’t update the config files. This results in the OS not being able to find the ethernet card.

So how do we fix this.

Luckily this isnt too hard to fix.

Step 1 – Remove the persistent rules file

rm -f /etc/udev/rules.d/70-persistent-net.rules

Step 2 – Reboot the box

sudo shutdown -r now

Step 3 – Open the network config file

for example eth0
sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0

Step 4 – Remove the MACADDR entry or update it to the new MACADDR for the interface (listed in this file: /etc/udev/rules.d/70-persistent-net.rules).

Step 5 – Remove the UUID entry

Step 6 – Save and exit the file

Step 7 – Restart the network service

sudo service network restart

If you have more than one missing network card, you only need to repeat steps 3 through 7

Thanks for reading.

CentOS, Redhat , , ,

1 comment


  1. Nice guide. Thanks for taking the time to write it and its helped me a lot.

Leave a Reply

Your email address will not be published. Required fields are marked *