Enable VirtualBox VM to VM Communications on Windows / Ubuntu 16.04 / 18.04

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 be frustrating to students and new users…

For example, right out of the box, VirtualBox’s virtual machines can not communicate with each other while attached to the default NAT network… VMs configured with the default NAT network configurations can only get to the Internet… with no VM to VM or host IP communication.

In order 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 is going to 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 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..

VM ↔ Host VM1 ↔ VM2 VM → Internet VM ← Internet
Host-only + +
Internal +
Bridged + + + +
NAT + Port forwarding
NAT Network + + Port forwarding

To allow VMs to communicate with each others, attach the VMs to the NAT Network settings…. continue below to learn how to do that.

Step 1: Create VirtualBox NAT Network

Before you can use NAT Network settings for VM, you must first 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

Step 2: Change 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 out.. Do this to all the VM that you want to enable inter-communication… After this change, all the VM that are attached to the NAT network should be able to communicate with each other and also get to the Internet.

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

Enjoy!

You may also like the post below:

How to Install Windows 10 Pro Guest Machine on VirtualBox Software

 

6 Replies to “Enable VirtualBox VM to VM Communications on Windows / Ubuntu 16.04 / 18.04

  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?

Leave a Reply

Your email address will not be published. Required fields are marked *

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

%d bloggers like this: