Network Configuration for Oracle VirtualBox VM: Multi-Network Client Communication
In this article, we will discuss how to configure three Oracle VirtualBox VMs with multiple networks, enabling client communication. The setup includes two machines connected to distinct networks and a third machine that contains both networks.
Creating Three Virtual Machines
The first step is to create three virtual machines in Oracle VirtualBox. To do this, open VirtualBox and click on the "New" button. In the "Create Virtual Machine" window, name the machine, select the type and version, and set the memory size. Then, click "Create" to proceed.
VBoxManage createvm --name VM1 --register
VBoxManage createvm --name VM2 --register
VBoxManage createvm --name VM3 --register
Configuring Network Adapters
Next, we need to configure the network adapters for each VM. For VM1 and VM2, we will set up one network adapter per machine. For VM3, we will set up two network adapters.
To configure the network adapters, first, select a VM and click on "Settings." Then, go to "Network" and add a new network adapter. For each adapter, select the "Attached to" option and choose the appropriate network. For VM1 and VM2, select a different network for each; for VM3, select both networks.
VBoxManage modifyvm VM1 --nic1 nat
VBoxManage modifyvm VM2 --nic1 nat
VBoxManage modifyvm VM3 --nic1 nat
VBoxManage modifyvm VM3 --nic2 nat
Enabling Client Communication
Finally, we need to enable client communication between the VMs. To do this, we will set up port forwarding rules for each VM's network adapter.
For VM1 and VM2, we will forward ports for both TCP and UDP traffic to the host machine's IP address and a specific port number. For VM3, we will forward ports for both TCP and UDP traffic to the host machine's IP address and a different port number for each network adapter.
VBoxManage modifyvm VM1 --natpf1 "rule1,tcp,1234,10.0.0.2,22"
VBoxManage modifyvm VM1 --natpf1 "rule1,udp,1234,10.0.0.2,22"
VBoxManage modifyvm VM2 --natpf1 "rule1,tcp,3456,10.0.1.2,22"
VBoxManage modifyvm VM2 --natpf1 "rule1,udp,3456,10.0.1.2,22"
VBoxManage modifyvm VM3 --natpf1 "rule1,tcp,5678,10.0.0.3,22"
VBoxManage modifyvm VM3 --natpf2 "rule1,tcp,7890,10.0.1.3,22"
VBoxManage modifyvm VM3 --natpf1 "rule1,udp,5678,10.0.0.3,22"
VBoxManage modifyvm VM3 --natpf2 "rule1,udp,7890,10.0.1.3,22"
- In this article, we discussed how to configure three Oracle VirtualBox VMs with multiple networks, enabling client communication.
- We created three VMs using the VirtualBox interface and the VBoxManage command-line tool.
- We configured the network adapters for each VM to attach to the appropriate networks.
- We enabled client communication by setting up port forwarding rules for each VM's network adapter.