Every now and again I clone a VM and add it to another host. ESXi prompts you for a new UID when you start the VM and I always remove the virtual network card(s) from the machine and re-add them later. I do this to make sure I don’t have two machines with the same MAC addresses on the network. But if you do this with Ubuntu, the new NIC(s) don’t get picked up by the OS. This is almost certainly not specific to VMware or their ESXi product, it’s just the environment I’m using.
This problem seems to be caused by a lack of automatic hardware probing at boot, probably for a good reason but I’m no Linux kernel guru so won’t make a judgement there. The root of the issue is located in the file /etc/udev/rules.d/70-persistent-net.rules where you’ll see the old interfaces still listed alongside the new ones. Simply remove the old NIC(s) and ensure the new ones have the MAC addresses you expect and the correct ethx labels. Give the system a reboot and you should be happy.
Steps to resolve a missing network interface in Ubuntu 10.04 Lucid Lynx (and possibly earlier):
- sudo nano /etc/udev/rules.d/70-persistent-net.rules
- Delete the lines with the old interfaces after comparing with your VMs newly assigned MAC addresses.
- Confirm the interface names are what you expect at the end of each line.
- Ctrl-X to save and exit.
- sudo shutdown -r now
- Run ifconfig to confirm the interfaces are up with the correct IPs.
- If the interfaces are up, check your /etc/network/interfaces config to adjust IP settings as required.