really hoping this is right place to ask this question seeing that my host is a Windows 7 machine. I have 3 Ubuntu Server 12.04 VMs set up through VirtualBox 4.1.18, and envisage the following usage:

  • LAMP - for Drupal, Moodle and other arbitrary PHP test applications (additionally a few of the Drupal installs need to communicate with some internet services)
  • SSH - to SFTP to the /var/www directory using FileZilla from Win7
  • SMTP service - for Drupal and Moodle installs to send test emails out from them.

Before I continue, I must stress that I'm not deeply knowledgeable with regard to networking in general, but I did read up on a few things to not make a complete fool of myself here!

I only have a single machine on my physical network - a laptop which connects to my router via WiFi and which picks up:

  • DHCP enabled = Yes
  • IPv4 =
  • Subnet Mask =
  • IPv4 Default Gateway =

And currently under NAT, VirtualBox assigns an IP of to my VM.

I started reading the following article (Host-Only Networking With VirtualBox) which was exactly what I wanted to accomplish, and got a good idea of how to setup NAT and Host-Only adapters for each desired VM. However I then got confused when I read this article (Networking between host and guest VMs in VirtualBox).

VirtualBox > File > Preferences > Network > Edit Host-only adapter, shows me an IPv4 address of and Mask of Would the following configuration for /etc/network/interfaces be correct for static IP under the VM:

# The host-only network interface
auto eth1
iface eth1 inet static

I am confused about the second referenced article mentioning that NAT will give on eth0, but then Host-only eth1 should be static and set to*. From the article: "Each NAT adapters and Host-only adapter should not reside in same sub-network". What should my eth1 interface block above contain? I am hesitant to try various options in case I end up breaking something, which why I'm asking here first...basically, What is the right way to this?

Thank you having the patience to read my question. Sincerely hope you can help me. TIA.

1 Answer 1


The host-only adapter allows the host and the VM to communicate with each other over the network. In other words, that is what is used when you SFTP to the /var/www directory. The host-only adapter in the VM must be on the same subnet as the virtual adapter on the host. On my system, it looks like this:



The NAT adapter in my VM has been assigned to, which doesn't match any of the adapters in the host.

  • Thank you! I bit the bullet and set up a new Ubuntu VM with NAT as Adapter 1, and then after installation was completed I shut the Vm down, enabled Network Adapter 2 as Host-only and restarted the VM. Edited the interfaces file as per my original post, rebooted the VM and an ifconfig showed that the change was registered. I can ping from the VM and download packages, and I can SFTP and SSH to it, and browse to LAMP apps from host browser. Thank you for confirming these for me.
    – maGz
    Jul 17, 2012 at 23:55
  • in the interfaces file, what is broadcast? Is this similar to nameserver?
    – maGz
    Jul 17, 2012 at 23:56
  • The braodcast ip is usually your network with 255 for the last octet: ip, netmask, network, broadcast The broadcast address is used to send a message to all the computers connected to a LAN (by sending ONE message to the broadcast address.)
    – Tom
    Jul 18, 2012 at 15:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .