This is more of a note to self. I had a Ubuntu 12.10 running on an Oracle VirtualBox VM (4.16). Now, this was running to too slow and it said an update had been released for VirtualBox(4.18). I uninstalled the previous version of VirtualBox while keeping the Ubuntu VM disk intact.

Now, after installing VirtualBox 4.18, when I used the Ubuntu VDI, I could no longer access the internet. Something must have gone horribly wrong. Then, I came across the following (excerpt from

  1. In the Ubuntu guest, open a command prompt. For more information, see Opening a command or shell prompt (1003892).
  2. As root, open the file /etc/udev/rules.d/70-persistent-net.rules in a text editor:

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

  3. The file consists of a line for each udev rule, associating MAC addresses with ethN interface names. For example:

    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:fb:d5:1e", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:fb:d5:1c", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

  4. Identify the old and new interfaces by their MAC address in the ATTR{address}=="" field. For example:

    ATTR{address}=="00:0c:29:fb:d5:1c" ... NAME="eth0"  # old
    ATTR{address}=="00:0c:29:fb:d5:1e" ... NAME="eth1"  # new

  5. Copy the ethN name from the old interface to the new interface line. For example:

    ATTR{address}=="00:0c:29:fb:d5:1c" ... NAME="eth0"  # old
    ATTR{address}=="00:0c:29:fb:d5:1e" ... NAME="eth0"  # new

  6. Delete the line for the old ethN interface. For example:

    ATTR{address}=="00:0c:29:fb:d5:1e" ... NAME="eth0"  # new

  7. Save the udev configuration file.
  8. Reboot the Ubuntu virtual machine.
When the system is rebooted, the network configuration for the previous network interface is applied to the new interface.
Note: If you are unable to reboot the virtual machine, you can manually restart the networking service using this command:
service networking restart
If this command fails with an unknown instance error, run this command:
/etc/init.d/networking restart
It is proof that this works ’cause am putting up this post from within the VM 🙂