Network interfaces for Ubuntu VirtualBox guest on Windows host

To work effectively and relatively securely on a VirtualBox guest system, the guest needs two network adapters - a NAT and a host-only adapter. The NAT interface allows talking out to the internet, and the host-only adapter allows ssh and http in from the host.

However, it seems that Ubunt/Debian only recognizes one network interface on system installation.

So to get two interfaces on the guest, I found the following to work :

First, create a host-only network for all VirtualBox instances. I think of this as creating a VirtualBox router. This is done thru File -> Preferences -> Networks. It should have values something like this :

IPv4 Address :
IPv4 Network Mask :

Then, create a new virtual machine with two network adapters. The first is NAT. The second is host-only, and use the 'Name' of the network you just created (ex. 'VirtualBox Host-Only Ethernet Adapter #1').

Boot your VM with the Ubuntu CD (.iso). Install Ubuntu. You may be asked a question or two about networking. As I recall you can take the defaults, skip, or make a 'best guess'.

After installing Ubuntu (and rebooting), ifconfig should yield the following :

eth0 Link encap:Ethernet HWaddr 08:00:27:36:dc:0e
inet addr: Bcast: Mask:

So aside from local, you'll only have one NAT Ethernet adapter. To add the second, host-only, adapter, add the following to /etc/network/interfaces :

# For host-only interface
auto eth1
iface eth1 inet static

Of course you'll have to vary the details to match your desired static IP and other network ('virtual router') details.

Now restart network services (or reboot) and you should have two network adapters.

The following are also useful for this :