Skip to content
Tutorials Center
My learning

Topics

Lesson 33 of 37 ยท Labs and Ethics

Building a Home Lab Safely

Design an isolated home lab for practising Metasploit: virtualisation, host-only networks, snapshots, intentionally vulnerable targets and rules that keep it contained.

The safest and cheapest way to learn is a lab you own: a few virtual machines on a network that cannot reach anything else. You can break things freely, take a snapshot before every experiment, and never need anyone's permission but your own. This lesson shows how to design one, how to keep it contained, and how to check your containment in code.

You will build on the legal ideas from Law, Ethics and Authorization: a lab is "in scope" only because you made the boundary yourself.

What a lab contains

flowchart LR
    subgraph Host["Your computer (hypervisor)"]
        A["Attacker VM (Kali or Parrot)"]
        T1["Target VM: intentionally vulnerable"]
        T2["Target VM: current patched OS"]
        S["Sensor VM: IDS / log server"]
    end
    A --- N["Isolated host-only network"]
    T1 --- N
    T2 --- N
    S --- N

All machines share a private, host-only network with no route to the internet or your home network.

  • Attacker machine: a Linux distribution with Metasploit installed (Kali Linux and Parrot include it).
  • Targets: machines you want to test. Mix old, vulnerable ones for learning with current, patched ones for realism.
  • Sensor: an IDS (Suricata) or log collector so you can practise defence from the same exercises.

Virtualisation choices

VirtualBox, VMware Workstation/Fusion, Hyper-V, KVM/libvirt or Proxmox all work. A computer with 16 GB RAM and an SSD runs three or four small machines comfortably. Containers (Docker) are handy for single vulnerable services but share the host kernel, so use virtual machines for kernel-level work and for anything that could escape.

Network isolation

This is the safety-critical part. Choose a network mode that has no path out:

Mode Reaches internet? Use
Host-only / internal network No Attack practice (recommended)
NAT Yes (outbound) Only for installing updates, then switch back
Bridged Yes, on your real LAN Never for vulnerable targets

Never attach a deliberately vulnerable machine to your home network: other devices could attack it, and it could attack them. Disable shared folders and clipboard sharing between the host and vulnerable guests, and keep guest additions off the targets.

Targets to practise on

Use targets created for this purpose, downloaded from their official projects and checked against published checksums:

  • Metasploitable 2 and 3: Rapid7's intentionally vulnerable Linux and Windows machines.
  • DVWA, OWASP Juice Shop, WebGoat: vulnerable web applications.
  • VulnHub and similar: community-built machines.
  • Hosted legal practice platforms (Hack The Box, TryHackMe) provide authorised targets in the cloud.

Download vulnerable images only from the project's official site, and verify the checksum. Never run a "vulnerable VM" from an unknown source.

Snapshots and routine

Take a snapshot of each machine in a clean state. After every exercise, revert. This makes experiments repeatable and mistakes free. Keep a text log per exercise: goal, steps, result, what you learned, what a defender would have seen.

A lab plan in code

The stand-in below holds a lab design as data and validates it: every machine must be on an isolated network, and any internet-connected machine is flagged.

Python Validate a lab design

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.

Checking addresses

Lab networks use private ranges. A quick check that a target address is private (and so cannot be a stray public host) is a cheap safeguard in any scripts you write.

Python Refuse non-private targets

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.

Note that a private address does not mean "yours": your employer's or school's network is private too, and testing it still needs permission.

Hardware, cost and tips

  • 16 GB RAM, 4+ CPU cores and 100 GB free disk are plenty to start.
  • Keep the attacker VM updated; keep vulnerable targets frozen and isolated.
  • Use a separate Metasploit workspace per exercise (workspace -a lab-01).
  • Start with one target and one goal; add machines as you progress.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which network mode is safest for vulnerable targets?

    Host-only networks have no route out, so vulnerable machines cannot reach or be reached from your real network.
  2. 2. Why take snapshots of lab machines?

    Snapshots let you undo damage and repeat exercises from a known state.
  3. 3. Where should a vulnerable VM be downloaded from?

    Unknown images can contain real malware.
  4. 4. Does a private IP address mean you may test it?

    Private ranges are also used by employers and schools; permission is still required.

Summary

  • A lab is an attacker, some targets and a sensor on an isolated network.
  • Use host-only networking; never bridge vulnerable machines to your LAN.
  • Download targets from official sources and verify checksums.
  • Snapshot, practise, revert, and keep notes of attack and defence views.
  • Validate lab designs and target addresses in code.

Next: Rules of Engagement and Reporting