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
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.
Pingback: Clone Ubuntu VMs in VirtualBox | splat operator