UnixDroid

Lesson 3 of 10 · 9 min

Lab networking: build an isolated LabNet

Understand VirtualBox's network modes and build LabNet, a private host-only network where attackers and targets talk safely.

Networking is where most home labs go wrong. Pick the wrong mode and your deliberately vulnerable VM is suddenly visible to everyone on your Wi-Fi, or your scans hit real devices in your house. In this lesson you'll learn what each VirtualBox mode does and build LabNet, the private network every machine in this path will use.

VirtualBox network modes at a glance
VirtualBox network modes at a glance

The five modes in plain English

NAT (the default). Each VM gets its own private virtual router, with the IP 10.0.2.15. The VM can reach the internet, but nothing can reach it, not even other VMs. Perfect for downloading updates.

NAT Network. One shared virtual router for several VMs. They can reach the internet and each other. Useful, but your vulnerable machines would then have internet access.

Bridged. The VM plugs straight into your real network, like another laptop on your Wi-Fi. It gets an IP from your home router, and every device on that network can reach it. Never use it for vulnerable VMs.

Host-only. A private network between your PC and your VMs, with no internet. VirtualBox's default host-only network is 192.168.56.0/24, and your PC is 192.168.56.1 on it. This is our LabNet.

Internal network. VMs only. Even your PC can't see it. Use it later for malware analysis, when you want a fully air-gapped network.

Our design: two adapters per VM

Every VM gets up to eight network adapters. We use two:

  • Adapter 1: NAT, for internet and updates. Turn it off when you don't need it.
  • Adapter 2: Host-only (LabNet), where all the attacking and defending happens.
VMAdapter 1Adapter 2LabNet IP
Kali / Parrot (attackers)NATHost-onlyDHCP
Ubuntu ServerNATHost-only192.168.56.20 (static)
Windows 11 (WS01)NATHost-only192.168.56.30 (static)
Windows Server (DC01)NAT, only until activatedHost-only192.168.56.10 (static)
Metasploitable 2Host-only onlynoneDHCP
Every machine joins LabNet; only safe machines get NAT
Every machine joins LabNet; only safe machines get NAT

Build LabNet

  1. In VirtualBox, open File → Tools → Network Manager.
  2. On the Host-only Networks tab, check whether one already exists. On Windows it's called VirtualBox Host-Only Ethernet Adapter; on Linux and macOS it's vboxnet0. If not, click Create.
  3. Adapter tab: choose Configure Adapter Manually, set IPv4 Address 192.168.56.1 and Network Mask 255.255.255.0.
  4. DHCP Server tab: tick Enable Server. Set Server Address 192.168.56.100, Lower Bound 192.168.56.101, Upper Bound 192.168.56.254.
  5. Click Apply.

On a Linux or macOS host you can do the same from the terminal:

VBoxManage hostonlyif create
VBoxManage hostonlyif ipconfig vboxnet0 --ip 192.168.56.1 --netmask 255.255.255.0
VBoxManage dhcpserver add --network=HostInterfaceNetworking-vboxnet0 \
  --server-ip=192.168.56.100 --netmask=255.255.255.0 \
  --lower-ip=192.168.56.101 --upper-ip=192.168.56.254 --enable

On Linux hosts, VirtualBox only allows host-only addresses inside 192.168.56.0/21 unless you list other ranges in /etc/vbox/networks.conf. Stick with 192.168.56.x and you'll never hit this.

The LabNet address plan

Static IPs below .100 and DHCP above it means addresses never clash:

AddressWho
192.168.56.1Your PC (the host)
192.168.56.10DC01, Windows Server domain controller
192.168.56.20Ubuntu Server
192.168.56.30WS01, Windows 11 client
192.168.56.100VirtualBox DHCP server
192.168.56.101–254DHCP pool: Kali, Parrot, Metasploitable

Copy this table into your lab notebook. You'll use it in every lesson that follows.

Attaching a VM to LabNet

For any VM: Settings → Network.

  • Adapter 1: Enable Network Adapter ✔, Attached to NAT.
  • Adapter 2: Enable Network Adapter ✔, Attached to Host-only Adapter, Name: your LabNet adapter.
  • Under Advanced on Adapter 2, set Promiscuous Mode to Allow VMs on your attacker. This lets Wireshark on Kali see traffic between other VMs, which you'll want for sniffing and ARP-spoofing labs.

Tip: the Cable Connected checkbox under Advanced works like unplugging a real cable. It's the quickest way to cut a VM off the internet without changing anything else.

Check it works

On your PC, run ipconfig (Windows) or ip a (Linux/macOS) and look for 192.168.56.1. Once Kali is installed in the next lesson:

ip -br a              # eth0 = 10.0.2.15 (NAT), eth1 = 192.168.56.1xx (LabNet)
ping -c 3 192.168.56.1

If pings from a VM to a Windows host get no reply, that's the Windows Firewall blocking incoming ping. The network is fine.

Safety check

Before powering on any VM, ask: does this machine have a Bridged adapter? For anything vulnerable, the answer must always be no.

Try it yourself
  1. Create or configure LabNet in File → Tools → Network Manager with host IP 192.168.56.1 and DHCP range .101–.254.
  2. On your PC, run ipconfig or ip a and find the 192.168.56.1 address.
  3. Copy the LabNet address plan into your lab notebook.
  4. In your own words, write which mode you'd use for (a) Kali updates, (b) Metasploitable, (c) a malware sample, and why.
No Linux machine? Practise in the free online terminal

Quick check

What is your PC's (the host's) IP address on LabNet?

Need a hint?

It's the first usable address in 192.168.56.0/24.

Finished this lesson?

Done lessons keep your daily streak going 🔥

0 day streak

0 lessons done

best 0 days

Log in to keep your streak on every device →