How to Enable VirtualBox VM to VM Communications on Windows or Ubuntu Linux

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 cannot 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.

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 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
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 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

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 that is attached to the NAT network should be able to communicate with each other and also get to the Internet.

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