Ariejan de Vroom – 11 December 2009
222 words in about 1 minute
Yesterday I had to clone a VPS to run some CPU and memory intensive tests. With our current setup (Xen + LVM), cloning an image on the fly is easy. After configuring a new IP address for the clone, I booted up the system. Nice, but I ran into a problem:
1 2 3 4 5 6 7 Configuring network interfaces...SIOCSIFADDR: No such device eth0: ERROR while getting interface flags: No such device SIOCSIFNETMASK: No such device SIOCSIFBRDADDR: No such device eth0: ERROR while getting interface flags: No such device eth0: ERROR while getting interface flags: No such device Failed to bring up eth0.
After some investigation I found that the MAC address for eth0 is stored on disk in
/etc/udev/rules.d/z25_persistent-net.rules. That makes sense, because the whole file system was cloned. But, I swapped the virtual network card, and I’d expect is to work. It didn’t. The solution is quite easy. Empty
/etc/udev/rules.d/z25_persistent-net.rules. Then shutdown and start your VPS. You must do a full shutdown, a reboot won’t work. For the lazy folk out there, here’s how to quickly empty the file:
1 echo "" > /etc/udev/rules.d/z25_persistent-net.rules
After you have started your VPS back up again, you should be able to ping out over the network. If you peek in
/etc/udev/rules.d/z25_persistent-net.rules you should see a line that contains the MAC address for your virtual network device.