VMWare

For years we’ve used bash scripting to ensure that all of our server configurations are standardized, so that we can expect servers with the same role to have the exact same configuration profile and exhibit the exact same behavior. We’re in the process of moving to Puppet but we’re not quite there yet. Recently we decided to redesign our network architecture with a higher level of focus around High Availability. This new design introduces Percona XtraDB Cluster and we’re writing our installation and configuration scripts to ensure that our new cluster boxes are both tuned and standardized.

We have base template linux VM’s in both VMWare and Oracle VirtualBox, and also templates that are specific to server roles such as web servers, HAproxy servers or MySQL Cluster servers. If we need to test a new configuration, or add a new node to the cluster, we just clone the appropriate template add some minor configuration and we’re good.

However if you clone a VMWare or Oracle VirtualBox VM, you’ll notice that it kills your network interfaces throwing errors like the one listed below:

#ifup eth0

Device eth0 does not seem to be present, delaying initialisation

What’s happening here is that when you clone your VM, VirtualBox and VMWare apply a new MAC Address to your network interfaces but they don’t update the linux configuration files to mirror these changes and so the kernel doesn’t firstly can’t find or start the interface that matches it’s configuration (with the old MAC Address) and it finds a new interface (the new MAC Address) that it has no configuration information for. The result is that only your networking service can only start the loopback networking interface and eth0 is dead.

So here’s how we fix it:

Remove the kernel’s networking interface rules file so that it can be regenerated

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

Restart the VM

# reboot

UPDATE your interface configuration file

# vim /etc/sysconfig/networking/devices/ifcfg-eth0

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