I have two virtual machines in VirtualBox. I would like to do networking between them. For the moment I have the default configuration on both, but they seem to have the same IP-address I would also like to be able to use Internet with both, and that is Possible now.

By default the network-setting is NAT, but it seems like they cannot network internally since they have the same IP. But If I change to internal networking I guess that I cannot access Internet with the virtual machines.

How can I set up networking between virtual guest AND have access to Internet on them?

9 Answers 9


Have you tried this Virtual Networking Guide ?

The virtual machine receives its network address and configuration on the private network from a DHCP server integrated into VirtualBox. The IP address thus assigned to the virtual machine is usually on a completely different network than the host. As more than one card of a virtual machine can be set up to use NAT, the first card is connected to the private network, the second card to the network and so on.

I think what you're looking for is "Internal Networking" , connecting internal VMs each other.

You can use a VM's "Settings" dialog in the VirtualBox graphical user interface. In the "Networking" category of the settings dialog, select "Internal Networking" from the drop-down list of networking modes. Now select the name of an existing internal network from the drop-down below or enter a new name into the entry field.


I found the following solution for my environment:

  • first adapter with internal network to access the other VM-
  • second adapter with NAT to access the internet.

Those settings can be done by the GUI Oracle VM VirtualBox Manager. Initially I had the same problem as Jonas, I missed DHCP. Finally I found this article (archived copy, original link is dead) and I used:

VBoxManage dhcpserver add --netname intnet --ip --netmask --lowerip --upperip --enable

from the command line. Afterwards it worked fine.

I dare say that the manual is a poor resource, as most of the configuration of VirtualBox on a Windows host can be done by the GUI and it is a severe inconvenience that one can't configure DHCP with the GUI.

My environment: I'm running portable VirtualBox 4.1.2r73507 on Windows 7 64 bit. Currently host-only and bridged mode not working, because host-only adapter is missing. I have a problem similar to that described in a german question on Virtual Box forum, I have no host only adapter.

  • I already have an intnet dhcpserver that somehow came by default when I installed virtualbox 4.3.x, but it doesn't connect to internet when I use nat with that.
    – pwned
    Mar 23, 2017 at 11:17

This is how I connect vbox guests in NAT mode only (tested on VirtualBox 4.2.4).

Just use the gateway IP to go from one guest to the host. Then use port forwarding to "proxy" the host traffic into the other guest.

For instance if guest A wants to reach a guest B service that listen on port 1000, A has to use the gateway IP (for the first NAT interface it is Then you need to configure port forwarding on guest B so that all traffic received by the host on port 1000 go to guest B on port 1000.

This might not work for every service but it seems to work just fine for ssh, salt, ...

In conclusion, you don't necessary need host-only mode to connect multiple guests but I don't mean to say that host-only mode is not the best option for your use case.

  • 1
    This worked flawlessly for my use case (testing ie8 on an xp guest connecting to a server in a linux guest).
    – Ted
    Mar 7, 2014 at 16:01
  • +1 for simplicity and being very straightforward! Jul 14, 2015 at 14:35

You need the host-connection LAN type (something like that in english version) on guest machines and bridge-connection on your host-machine.


(answer to question by bernd_k)

For sharing files between the host and guests, one actually shares directories rather than files.

If the network mode is bridged or NAT, then the host and guests are each equal network partners. Although the whole setup is contained in the one host, network-wise they are all equal on the network, as if they were physical machines. (NAT is sometimes more problematic to use than bridged.)

This way, any shared folder in any computer, virtual or physical, is available to all. Because not all virtual machines may be turned on all the time, it makes sense to setup one folder of the host as the shared folder. The host then shares the folder, and the virtual machines use it as-is or as a mapped drive.

The following article explains with great detail how to share folders in Windows :
How do I share folders in Windows 7 with the Shared Folder Wizard?

  • 2
    Your hints are valuable at a later stage, but before sharing files or folders you must be able to ping the other machine.
    – bernd_k
    Sep 25, 2011 at 16:01

I have two network cards on my Oracle VM XP PC

1st Bridged with a fast IP address as im using this as a client with a server network configuration. Changed the default gateway to the same as network card two (Nat 2nd)

2nd Nat With obtain IP address from Oracle VM

works fine!


I did the following steps and it worked fine with me finally (on CentOS VB):

  • Use the NAT for the Primary Network adapter (Settings -> Network -> Adapter1 "attached to NAT").
  • Add another adapter (Settings -> Network -> enable Adapter2 "attached to Host-only Adapter") -> set "Promiscuous Mode" to "Allow All".
  • Start the VB.
  • Add another network interface (cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth1).
  • Change the MAC address for eth1 according to the one which appears in the Adapter2 ((Settings -> Network ->).
  • Restart the network "service network restart"

Then this VB should access the Internet and could be accessible from the others (VBs and local machine).


The NAT adapter will be used to access the Internet while the Host-Only adapter will be used for networking access between any other VBs and the local machine as well.


I don't know if it will work, but my idea is:

  1. Change IP to diff number in only one virtual machine (in NAT mode).

  2. Change other virtual machine to Bridged.

  3. Set settings on both systems to machines find each other. Restart everything.

If 1+3 or 1+2+3 don't work, try this: Make a Shared Folder on host machine and share the folder to the 2 virtualbox machines on virtualbox settings. Restart and voilá?

I know the second option is a workaround.


Change the network attached to Bridged Adapter in the Network under Setting.

That's it; It can connect two virtual PCs.

You must log in to answer this question.

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