Network interfaces on cloned (KVM) VMs

Yesterday I was cloning a few KVM VMs and to my disappointment the clones did not have an eth0 but rather got an eth1 and clones of clones would actually get eth2 and so forth. Because my /etc/network/interfaces referred to eth0 it simply failed.

Not so nice. I am using Debian on these, so I was checking with dmesg and a message caught my attention where udev stated that it had renamed eth0 to eth1. Fair enough. So it turned out that udev is keeping track of attached network devices by their MAC address. One can fix that either by giving completely custom name mappings (there is a package for that) or by “restarting” the list of known devices through removal of the known ones in either of these two files:

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

The first one seems to be the older location – the system I was on had the file in the latter location.

// Oliver

This entry was posted in EN, Linux, Unix and unixoid. Bookmark the permalink.

Leave a Reply

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