Setting a Virtual Network in VirtualBox

On Virtualbox, we go to File > Preferences > Network and add a new Host-Only Network and configure DHCP for it.

new network virtualbox

network details

Then on each VM > Settings > Network you’ll want to set a new Host-Only adapter and select the network you just created.

network adapter

Once we’re done installing Ubuntu, inside the VM we want to check the adapter names and verify that the second adapter (enp0s3) does not have an IP attached yet. We check the interfaces configuration with:

After that, we edit the interfaces the VM has configured and add the secondary network interface with the name of the second adapter so it looks like this.

interfaces vm

After that our adapter should have an IP attached to it.

adapter configured

We repeat the steps for the other guest VMs and you can verify connectivity by pinging each other.

We cover those steps in the following video: