How to Enable VirtualBox VM to VM Communications

computer no table with keyboard
computer no table with keyboard

This brief tutorial shows students and new users how to enable virtual machines created on VirtualBox to communicate with each other. Since VirtualBox 5.2 was released, I have discovered some default settings that may frustrate students and new users.

For example, right out of the box, VirtualBox’s virtual machines cannot communicate with each other while attached to the default NAT network. VMs configured with the default NAT network can only access the Internet without VM-to-VM or Host IP communication.

To allow virtual machines to communicate with each other, you must change the VM network settings to use NAT Network, but you can’t use that Network setting if you haven’t already created it.

This brief tutorial will take the pain out of the process for students and new users.

Below is the Network table for VMs. As you can see VMs with NAT network settings cannot talk to the Host or other VMs, but can’t get to the Internet.

VMs with NAT Network settings cannot talk to the Host computer but can communicate with other VMs and can’t go to the Internet.

VM ↔ HostVM1 ↔ VM2VM → InternetVM ← Internet
Host-only++
Internal+
Bridged++++
NAT+Port forwarding
NAT Network++Port forwarding

To allow VMs to communicate with each other, attach the VMs to the NAT Network settings. Continue below to learn how to do that.

Create VirtualBox NAT Network

Before using NAT Network settings for VM, you must create a NAT Network interface. To do that, open VirtualBox software and click File ==> Preferences.

virtualbox nat network

On the Preferences page, go to Network and click Add to create a new NAT Network.

VirtualBox NAT Network

Change the Virtual Machine to use the new NAT Network

Now that the new NAT Network is created, go to each Virtual Machine and change the network settings to use NAT Network as shown in the image below

virtualbox nat network settings

Save the VM settings and close.

Do this to all the VM that you want to enable inter-communication. After this change, all the VM attached to the NAT network should be able to communicate with each other and get to the Internet.

These should probably be the default settings for VMs created on VirtualBox.

Enjoy!

Posted by
Richard

I love computers; maybe way too much. What I learned I try to share at geekrewind.com.

8 Comments

  1. Thanks mate! Out of 10’s unhelpful articles and stackoverflow threads, this was the only one the addressed the problem clearly and had a working solution. Good job!

  2. Very well and precise documented. I spent hours and hours making two VM talking in vBox. I did a clean install and did this in two minutes and voila.

    However, I think this should be as:

    From:

    Below is the Network table for VMs.. as you can see VMs with NAT network settings can not talk to the Host, or other VMs, but can’t get to the Internet…
    VMs with NAT Network settings can not talk to the Host computer, but can communicate with other VMs and can’t go to the Internet..

    To:

    Below is the Network table for VMs.. as you can see VMs with NAT settings can not talk to the Host, or other VMs, but can get to the Internet…
    VMs with NAT Network settings can not talk to the Host computer, but can communicate with other VMs and can go to the Internet…

    Thanks!

  3. Hello,

    Thanks for the valuable article. I followed this tutorial but I can not able to connect to the VM from my Host machine. How we can enable this?

    1. I think this article is good but needs more clarification.

      With the “NAT Network” setting, the port forwarding option is disabled. So how do I know which port to try to connect to? (I am assuming it still uses the same host 127.0.0.1.)

      With the “NAT” setting, I can set port forwarding so specific ports are used. eg port 2222 for SSH and thus from the host, I can connect to the VM using 127.0.0.1:2222

      When logged into the VM, I can go to the File manager -> Other Locations and see “Computer” and “Windows Network” but not the other VM.

  4. Hello,

    Thanks for the superb article. I followed this but I can not able to connect with VM from my host machine. How can I enable it?

  5. awesome …table on network slove my problem of a week in a second

  6. Hi I am new to this forum, please help on this Oracle virtualbox network connection problem

    I have created 3 NAT networks,
    ENT network- 192.168.10.0/24
    Client network – 172.168.10.0/24
    Tech network – 10.10.10.0/24

    And I configured DC in a VM in ENT network, and I am able to add other VM’s from ENT network to the domain

    But iam not able to add VM’s from other networks (Client & Tech) in the domain

    Infact not able to ping/connect VM’s between different NAT networks

  7. Manish Chourasia

    HI
    I have added the same but did not worked for me , my ubutu has assigned 192.168.1.7 and windows having 192.168.1.8 IP address but ubutu to windows ping is not working but viseversa has worked

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: