A feature of all Debian derivative OSs including Ubuntu is that it uses the udev to build the /dev tree during bootup. See man udev for more details. udev uses the files in /etc/udev/rules.d/ to tell it how to build the device tree. The file that we're interested in is 70-persistent-net.rules. When you first configure your VM, a MAC address is generate, say 08:00:27:12:34:56, and the following lines get automatically added to the file during the first boot sequence:
Code: Select all
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:12:34:56", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
Code: Select all
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:12:34:56", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:23:45:67", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
The solution is to edit this file (in sudo) to delete the first entry and rename the second to eth0. You'll find that eth0 is then recognised properly on reboot.