Skip to content
Tutorials Center
My learning

Topics

Lesson 3 of 31 ยท Ethics, Law and Lab Setup

Building a Safe Lab

Set up a safe practice lab for security learning: virtual machines, isolated host-only networks, snapshots and intentionally vulnerable training systems.

Once you know you need permission for every target, the next question is: where do you practice? The answer is a lab: a small, private, disposable network that you own completely. In a lab you can scan, misconfigure, break and rebuild things without harming anyone. A good lab is also how professionals test a tool before they use it on a client.

The word that matters most is isolated. A lab that leaks onto your home network, or worse onto the internet, defeats its own purpose. This lesson shows how the pieces fit and what mistakes to avoid.

What a lab is made of

The parts of a home lab

Host machine Your real computer running the hypervisor.
Virtual machines Kali plus one or more training targets.
Isolated network A virtual switch only the VMs share.
Snapshots Saved states you can roll back to.

Everything dangerous lives inside the isolated network.

1 / 2

Hypervisors

A hypervisor runs virtual machines on your computer. Common choices are VirtualBox, VMware Workstation or Fusion, Hyper-V on Windows, and KVM/QEMU on Linux. Any of them works for a beginner lab. Pick the one that runs well on your hardware, and give each VM a sensible share of RAM (4 GB for Kali is comfortable, 1 to 2 GB for small targets).

Virtual networks

The hypervisor offers several network modes. The names differ between products, but the ideas are the same.

Mode What it does Use in a lab
NAT VM reaches the internet through the host; outside cannot start connections in Good for Kali updates. Not for vulnerable targets.
Bridged VM appears as a real device on your physical network Avoid for anything vulnerable. It exposes the target to your LAN.
Host-only VM talks only to the host and other VMs on that virtual network Ideal for target machines.
Internal / isolated VMs talk only to each other, not even to the host Strictest. Great for malware analysis and fragile targets.

A common design uses two network adapters on Kali: one NAT adapter for updates, one host-only adapter for the lab. The targets get only the host-only adapter, so they cannot reach the internet and the internet cannot reach them.

flowchart TB
    NET["Internet"] --- NAT["NAT adapter"]
    NAT --- K["Kali VM"]
    K --- HO["Host-only network<br/>192.168.56.0/24"]
    HO --- T1["Training target A"]
    HO --- T2["Training target B"]
    HO -.-x NET

Targets sit only on the host-only network; there is no path from them to the internet.

Snapshots: your undo button

A snapshot records the exact state of a VM: disk and, optionally, memory. Take one:

  • right after installing and updating Kali (a "clean baseline"),
  • before you try anything that changes a target,
  • before upgrading something large.

If an experiment breaks the machine, you restore the snapshot in seconds. Snapshots are not backups (they live next to the VM and can be lost with it), but they make a lab fearless to experiment in.

Hypervisors usually have a command line too. These commands are read-only here because they need VirtualBox installed:

Terminal
VBoxManage list vms
VBoxManage snapshot "kali-lab" take "clean-baseline"
VBoxManage snapshot "kali-lab" restore "clean-baseline"
VBoxManage list hostonlyifs

Intentionally vulnerable training machines

You do not have to invent weak systems. The security community publishes intentionally vulnerable applications and virtual machines made for learning, such as OWASP Juice Shop, DVWA (Damn Vulnerable Web Application), Metasploitable, and many downloadable VMs on practice platforms. Hosted practice sites also exist where the owner gives everyone permission to attack their labelled targets.

Safety rules for these:

  1. Download from the project's official page and check any published checksum. A "vulnerable VM" from a random forum could carry real malware.
  2. Never expose them to the internet. They are meant to be exploitable, and anyone who finds one will take it over.
  3. Keep them on host-only or internal networks. This is the key rule.
  4. Do not reuse real passwords in them, ever.
  5. Treat them as untrusted when handling files you copy out.

Never test on production

Production systems are those real people depend on. Even with permission, a test on production needs extra planning: a quiet window, backups, a rollback plan and a named contact. For learning, the rule is blunt: do not scan or probe your school, employer, internet provider, or any live website unless you have a signed authorization. Your own lab and the official practice platforms are where you learn.

A stand-in: checking a lab plan for isolation mistakes

Misconfigured networks are the number one lab mistake, so it helps to check a plan before building it. This stand-in takes a plan as data and reports risks. It models the ideas only; it does not touch any network.

Python Audit a lab plan for isolation mistakes

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The rules in audit are the ones above, written as code. A review like this, even on paper, catches mistakes before a vulnerable machine goes live.

A stand-in: the snapshot habit

A second stand-in shows why snapshots make experiments cheap. It models a VM's state as a dictionary and restores it.

Python Snapshots as saved state

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The real feature works at the disk level, but the principle is identical: capture state once, change freely, roll back.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which network mode is the safest for an intentionally vulnerable target?

    Host-only and internal networks keep the target away from your real LAN and the internet. Bridged mode puts it directly on your physical network.
  2. 2. What is a snapshot best used for?

    Snapshots give a quick rollback to a saved state. They are not a replacement for real backups.
  3. 3. Why should you download training VMs only from official project pages?

    A modified image can hide real malware. Use the official source and verify any published checksum.
  4. 4. Where is it acceptable to practice scanning without extra permission?

    You own your lab, and practice platforms grant permission on their labelled targets. Everything else needs written authorization.

Summary

  • A lab is a private, disposable network you own, built from a hypervisor, VMs and a virtual switch.
  • Keep vulnerable machines on host-only or internal networks; never bridge them to your LAN.
  • A typical Kali VM has a NAT adapter for updates and a host-only adapter for the lab.
  • Snapshots let you experiment and roll back, but they are not backups.
  • Use official intentionally vulnerable projects, verify downloads, and never expose them to the internet.
  • Never practice on production or on systems you have no permission to test.

Next up: Installing and Updating Kali.