Setup VirtualBox Internal Network (Ubuntu)

While it might seem logical for all VirtualBox guest systems to be connected to the same network, this is not the case. Each guest system is, essentially, isolated from all other systems. This is good because you may not want every guest to be visible to every other guest.

Fortunately, it is possible to create a private network that allows guest systems to communicate with each other.

Version Notes: Created on September 19, 2023. Covers version 7.0.10 of Oracle VirtualBox on Windows 11 and Ubuntu Server v22.04.3 LTS.

Update the Virtual Guest Settings


Open Network Adapter Settings

NOTE: Once you create the Internal Network on one VM, you will be able to select it from the drop-down list for the others. 


Install Net-Tools

It is likely that the net-tools package is not installed.

$ ifconfig -a
Command 'ifconfig' not found, but can be installed with:
sudo apt install net-tools

If you get the above error when running ifconfig, use the following to install net-tools. You will need to enter your password when prompted.

$ sudo apt install net-tools

Identify the Interface

Each system on your internal network will need to have an appropriate IP address. Be sure to make note of each IP that you will assign to each guest system. The IPs will all need to be on the same network. For this example, I will be using IPs on the 192.168.1.x/24 network.

$ ifconfig -a
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.2.15  netmask 255.255.255.0  broadcast 10.0.2.255
        inet6 fd00::a00:27ff:fe6b:ef17  prefixlen 64  scopeid 0x0<global>
        inet6 fe80::a00:27ff:fe6b:ef17  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:6b:ef:17  txqueuelen 1000  (Ethernet)
        RX packets 222  bytes 22066 (21.5 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 160  bytes 18010 (17.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp0s8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::a00:27ff:feb6:871a  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:b6:87:1a  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 49  bytes 7462 (7.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

NOTE: Your output and network interface names might be different.


Configure IP Address

We need to use netplan to assign an IP address to the interface.

$ sudo netplan set ethernets.enp0s8.addresses=[192.168.1.51/24]
$ sudo netplan apply

Running ifconfig -a again will show that the enp0s8 interface now has the IP assigned and it is up and running.


All Done

Repeat the above steps for each VM on your internal network. Be sure to assign each VM a different IP address.

Once complete, you can test that the network is operating as expected by pinging each host from the others.