Prevent Virtual Machines from Saving Network Interface udev Rules

I use a lot of VirtualBox VMs. A problem that I have frequently is that when cloning an Ubuntu VM and changing its MAC address is that it won’t be able to initialize the network (as seen in a previous post). I found a permanent fix for this!

Before you clone your VM, you can block the creation of the udev rule that remembers your MAC address/interface bindings.

rules='/etc/udev/rules.d/70-persistent-net.rules'
sudo rm $rules && sudo mkdir $rules

That’s it! Clone away. Now that there is a directory where the udev rule is normally written, the rule won’t be written. It will just fail silently, and the bindings (e.g. MAC address 00:11:22:33:44:55 maps to eth0) will be generated dynamically upon boot. The MAC address won’t change, and the order of your interfaces won’t change, so there’s really no drawback.

This entry was posted in virtualization and tagged , , , , . Bookmark the permalink.

One Response to Prevent Virtual Machines from Saving Network Interface udev Rules

  1. Pingback: Clone Ubuntu VMs in VirtualBox | splat operator

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>