top of page
Buscar

How to Connect Two VirtualBox VMs on the Same Network – A Step-by-Step Lab Guide

  • Foto do escritor: Flavio Tazinazo
    Flavio Tazinazo
  • 8 de mai. de 2025
  • 2 min de leitura

Atualizado: 12 de mai. de 2025

If you're building a cybersecurity home lab or just testing out client-server tools, one essential skill is connecting multiple virtual machines (VMs) so they can communicate with each other. In this tutorial, I’ll show you how to link two VirtualBox VMs using a Host-Only Adapter, which allows them to share a local network while staying isolated from the internet.

✅ Step 1: Create or Enable a Host-Only Network

  1. Open VirtualBox.


  1. Click File > Host Network Manager.

  2. If no network is listed, click Create.

  3. Ensure the network is:

    • Enabled

    • DHCP enabled (optional, but makes IP configuration easier)



✅ Step 2: Configure Each VM

Do this for both VMs:

Go to the VM Settings → Click the Network tab.

Enable Adapter 2 (keep Adapter 1 as NAT for internet).

Set Attached to → Host-Only Adapter.

In the Name dropdown, choose the network you created (e.g., vboxnet0).

Click OK.



✅ Step 3: Start Your VMs

Start both virtual machines so we can find their IP addresses and test the connection.



✅ Step 4: Find the IP Address of Each VM

🐧 Linux (e.g., Kali):

Open the terminal and run:

bash

CopyEdit

ip a


Look for an interface like enp0s8 or eth1, and find the line that shows:

nginx

CopyEdit

inet 192.168.56.101/24


That’s your VM’s local IP.

🪟 Windows:

Open Command Prompt and run:

cmd

CopyEdit

ipconfig


Look under VirtualBox Host-Only Adapter for the IPv4 address.



✅ Step 5: Test the Connection

From one VM, run:

bash

CopyEdit

ping [other VM’s IP]


For example:

bash

CopyEdit

ping 192.168.56.102


If you get a reply, your VMs are connected!



🧠 Pro Tips

  • Want internet and local network? Use:

    • Adapter 1: NAT

    • Adapter 2: Host-Only

  • Can’t ping? Temporarily disable firewalls for lab testing.

  • For full isolation (no host access), try Internal Network instead of Host-Only.



🎯 Conclusion

Setting up communication between VMs is essential for practicing cybersecurity, ethical hacking, and server-client simulations. With just a few simple steps, you’ve now created a mini-lab right on your machine using VirtualBox.

Stay tuned for more tutorials, including setting up Active Directory, launching CTF labs, and building your first SIEM environment.



🔗 Tags:


 
 
 

Comentários


bottom of page