I need to create a VirtualBox network that will connect some guest OS each other and with my host machine.

All the guests OS's will be configured to have static IP addresses in the same subnet and with the same gateway (tipically the host ip).

How can I achieve this?

EDIT April 6 2011

I have been able to create a virtual network of Win 2008 R2 Servers using the "Host Only" network mode and specifying static IP addresses for each server.

I am able to work with the servers from the host machine but I am not able to browse the internet from "every" guest machine in the network (3 virtual servers).

I have tried using the following methods:

  1. I have added a second NIC to every guest and configured this second NIC to have "Bridged networking". This solution works just for the first server that is in the network. Any other server it is not able to get a valid IP from the DHCP.
  2. I have configured the gateway of the servers being the virtual IP address assigned to the host machine. I know that this solution it's not correct and cannot work.

Any suggestion?


One option is to continue to use your existing host-only interfaces, but then add a NAT interface to each VM. Set the default gateway to use the NAT interface (mine appears to be by default). You should have no problem continuing to connect to your VMs from your host via the existing host-only networking.

I prefer this to bridged, as I usually don't want to have other machines on the network able to connect to my VMs.

  • Let me understand a bit more. Every VM will then have two NIC (one host-only and the other NAT) and the config for the host-only NIC will have default gateway to the IP of the NAT nic? Right? – Lorenzo Apr 7 '11 at 10:37
  • Sorry, misread that a minute ago. The default gateway should be whatever the NAT interface gets by DHCP. In my case it was on all my guests. – Cakemox Apr 7 '11 at 10:51
  • Ok! Let's go and make a try! – Lorenzo Apr 7 '11 at 10:56
  • Thanks for your help... I am going to award the bonus in a couple of hour! – Lorenzo Apr 7 '11 at 12:26

Just be sure to use a "bridged adapter" (and select your LAN connected physical adapter). From here, you'll be able to set a static IP on the VM which can communicate with the physical host, internet, and all other hosts on the LAN :) (including other VM's).

VirtualBox adapter settings

  • I would like to have the network working even when my host machine is not connected to any physical network. Does this configuration work in this case? – Lorenzo Mar 24 '11 at 15:50
  • 1
    Yes it sure does. I am currently running a VM in bridged mode and I just tested by unplugging my physical network connection. It just needs a card to bind to. – cjones26 Mar 24 '11 at 15:52
  • can you please have a look to my question edit? Thanks! – Lorenzo Apr 6 '11 at 15:21
  • This sounds like it may be an issue on the host machine, as I use multiple VM's set in bridged mode which speak to both each other and the internet. What OS are you running? – cjones26 Apr 7 '11 at 7:39
  • I am on a notebook with Windows 7 x64 and 8Gb RAM – Lorenzo Apr 7 '11 at 10:33

The interface configuration of the machines shall be NAT or Internal network for this to work. If the interface are set to Host only, you need to manually route the packets with the host.

If using NAT, you shall profit the DHCP as well, so no need to have static IP unless you want to forward ports.

  • Thanks for your answer. I am using NAT but I am not able to ping those guests at all... – Lorenzo Mar 24 '11 at 15:51
  • I don't know what OSes are your guests, but did you try DHCP configuration first to learn about the Gateway IP? Since it should be the Virtual IP of your computer, not the one you have on the real network. – M'vy Mar 24 '11 at 15:54
  • can you please have a look to my question edit? Thanks! – Lorenzo Apr 6 '11 at 15:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.