How to Set Up a Penetration Testing Lab in 2026: Tools, OS, Network Topology and Practice Scenarios
Setting up a penetration testing lab involves creating an isolated virtual environment using tools like VirtualBox, VMware, or Proxmox, deploying attacker and vulnerable virtual machines (e.g., Kali Linux, Metasploitable), and configuring internal network topologies. It allows ethical hackers to safely test exploits, practice red team tactics, and prepare for certifications like OSCP. This guide covers hardware requirements, virtualization platforms, essential operating systems, network setup, and top tools for scanning, exploitation, and automation.
Quick answer: To set up a penetration testing lab, install a free hypervisor (VirtualBox, VMware Workstation Pro or Proxmox), create a Kali Linux attacker VM and one or two deliberately vulnerable targets such as Metasploitable or DVWA, and put them on an isolated host-only or internal network. Take snapshots before every exercise, keep targets off the internet, and only attack machines you own.
Key takeaways
- Build the lab on an isolated host-only or internal network, so vulnerable targets such as Metasploitable never touch the internet.
- Take a snapshot of every VM before each exercise, so you can break things freely and restore in seconds.
- Start with Kali and one or two targets like DVWA in an evening, then grow the range toward Active Directory.
A home lab is where you practise scanning, exploitation, defence and report writing without touching anyone else's systems. This guide takes you from a single laptop to an Active Directory range, with the network layout, step-by-step build, practice scenarios and the safety rules that keep the lab legal.
Why build your own pentest lab?
A lab gives you a place to make mistakes safely and repeat them until the skill sticks. It matters for four reasons:
- Hands-on skill: penetration testing is learned by doing. Reading about SMB enumeration is not the same as finding a misconfigured share yourself.
- Legal safety: testing systems you don't own or have written permission for is an offence under India's IT Act, 2000. A lab removes that risk.
- Certification prep: practical exams such as OSCP (PEN-200), CEH Practical and CPENT are timed and hands-on. A lab lets you rehearse the full workflow.
- Both sides of the attack: add logging and you see what your own actions look like to a defender, which makes you better at both jobs.
What hardware do you need?
A laptop or desktop with 16 GB RAM, a 4-core CPU with virtualisation enabled in BIOS/UEFI (Intel VT-x or AMD-V) and an SSD with about 250 GB free runs a basic lab comfortably. RAM is the real limit, because every VM holds its memory while running.
| Lab size | RAM | CPU | Storage | What it runs at once |
|---|---|---|---|---|
| Starter | 8 GB | 4 cores | 150 GB SSD | Kali + one light Linux target |
| Comfortable | 16 GB | 4 to 6 cores | 250 to 500 GB SSD | Kali + 2 or 3 Linux/web targets |
| Active Directory | 32 GB or more | 8 cores | 1 TB NVMe | Kali + domain controller + 2 Windows clients + a logging VM |
If your laptop is already short on memory, an old desktop or a second-hand mini PC running Proxmox makes a good always-on lab box. Cloud labs are covered further down.
Which virtualisation platform should you use?
For a single laptop, VirtualBox or VMware Workstation Pro is the easiest choice. For a dedicated lab machine, use Proxmox VE.
| Platform | Cost (2026) | Runs on | Best for |
|---|---|---|---|
| VirtualBox | Free, open source | Windows, Linux, macOS (Intel and Apple silicon) | Beginners, simple host-only networks |
| VMware Workstation Pro / Fusion Pro | Free for personal, educational and commercial use since November 2024 (Broadcom notice) | Windows, Linux (Workstation); macOS (Fusion) | Stable desktop labs with flexible virtual networks |
| Hyper-V | Included in Windows Pro, Enterprise and Education | Windows hosts | Windows-heavy and AD labs |
| Proxmox VE | Free, open source (paid support optional) | Bare metal (Debian based) | Always-on labs, VLANs, many VMs |
Pick one and stay with it. Mixing hypervisors on the same laptop (for example Hyper-V and VirtualBox) can cause performance problems on Windows.
Which operating systems go in the lab?
Attacker machine
- Kali Linux: the standard choice. Offensive Security publishes ready-made VirtualBox and VMware images on the official Kali download page, so you don't need to install from scratch. Give it 4 GB RAM, 2 vCPUs and at least 40 GB of disk.
- Parrot Security: a lighter alternative if your laptop is short on RAM.
New to Kali? Start with how to learn Kali Linux as a beginner before you build the rest.
Target machines
| Target | What you practise | Notes |
|---|---|---|
| Metasploitable 2 | Network service enumeration and classic exploits | Very old and extremely insecure. Host-only network only, never bridged. |
| Metasploitable 3 | Windows and Linux service flaws | Built with Vagrant/Packer; heavier but more realistic |
| DVWA, OWASP Juice Shop | Web vulnerabilities (SQL injection, XSS, broken authentication) | Run as Docker containers on a small Ubuntu VM |
| VulnHub-style VMs | Full "boot to root" practice | Download only from trusted sources and scan the image first |
| Windows Server evaluation + Windows clients | Active Directory enumeration and misconfigurations | Microsoft offers time-limited evaluation editions for lab use |
| Security Onion or Wazuh | Detection and log analysis (blue team) | Needs more RAM; add once the basics work |
How should the lab network be laid out?
Put attacker and targets on a network that cannot reach your home LAN or the internet, and give only the attacker a second adapter for updates. This is the single most important design rule.
Internet
|
[ Home router ]
|
[ Host PC ]
|
NAT adapter (updates only, Kali only)
|
+---------------+-----------------------------+
| Isolated lab network (host-only/internal) |
| 192.168.56.0/24 |
| |
| Kali (attacker) 192.168.56.10 |
| Metasploitable 2 192.168.56.20 |
| Ubuntu + DVWA 192.168.56.30 |
| Windows DC (AD lab) 192.168.56.40 |
+---------------------------------------------+
| Network mode | What it does | Use in the lab |
|---|---|---|
| NAT | VM reaches the internet through the host; nothing can reach in | Kali only, for updates. Disconnect it during exercises if you like. |
| Host-only | VMs talk to each other and the host, not to the internet | Main lab network |
| Internal network | VMs talk only to each other, not even the host | Extra-isolated segments, malware analysis |
| Bridged | VM sits directly on your home or office network | Avoid for vulnerable targets |
On Proxmox you can go further with separate Linux bridges or VLANs, for example a "user" segment and a "server" segment joined by a pfSense or OPNsense firewall VM. That lets you practise pivoting and firewall rules later.
Step-by-step: build a starter lab in an evening
- Enable virtualisation. Turn on Intel VT-x or AMD-V in BIOS/UEFI, then install VirtualBox or VMware Workstation Pro.
- Create the isolated network. In VirtualBox, open the Network Manager and create a host-only network (the default is usually 192.168.56.0/24). In VMware, use a host-only VMnet. Turn off the built-in DHCP server if you plan to use static IPs.
- Import Kali. Download the pre-built VM image, import it, and give it two adapters: NAT and host-only. Update it with
sudo apt update && sudo apt full-upgrade -y. - Add a target. Import Metasploitable 2 (or build an Ubuntu VM running DVWA in Docker) with a single host-only adapter and no NAT.
- Check isolation. From the target, a ping to the internet should fail. From Kali, the target should answer.
- Snapshot everything. Take a clean "baseline" snapshot of every VM before you touch it.
- Write down the scope. Note your lab subnet and the IPs you are allowed to test. It sounds formal, but it builds the habit you'll need on real engagements.
Quick checks from Kali:
# Confirm your lab IP and that you're on the right subnet
ip -br addr
# Discover live hosts in your lab subnet only
nmap -sn 192.168.56.0/24
# Service and version scan of a single lab target
nmap -sC -sV -oN target20.txt 192.168.56.20
Always type the lab subnet explicitly. A mistyped range is the most common way students end up scanning a network they don't own.
Practice scenarios to work through
Once the lab is running, work in a structured order. Each scenario should end with a short written finding: what you found, why it matters and how to fix it.
| Scenario | Target | Skills | Defensive takeaway |
|---|---|---|---|
| Recon and enumeration | Metasploitable 2 | Nmap, service versions, banner grabbing | Close unused services, patch old versions |
| Web application testing | DVWA, Juice Shop | Burp Suite or OWASP ZAP, input validation flaws | Parameterised queries, output encoding |
| Password security | Lab Linux accounts you create | Weak password policy, hash formats, John the Ripper | Strong policy, MFA, lockout and monitoring |
| Privilege escalation | Linux and Windows targets | Misconfigured sudo, services and permissions | Least privilege, hardening baselines |
| Active Directory | Your own small domain | Enumeration, weak service accounts, Kerberos basics | Tiered admin model, strong service account passwords |
| Detection | Security Onion or Wazuh | Find your own scans and logins in the logs | Write alerts for what you just did |
For a fuller AD practice range, the open-source GOAD (Game of Active Directory) project builds a deliberately vulnerable multi-domain lab. It needs a lot of RAM, so treat it as a later step. For a tour of what Kali ships with, see top ethical hacking tools in Kali Linux.
Core tools by category
| Category | Tools (all available in Kali) |
|---|---|
| Scanning and enumeration | Nmap, Netcat, enum4linux-ng, Nikto |
| Web testing | Burp Suite Community, OWASP ZAP, ffuf, sqlmap |
| Exploitation framework | Metasploit Framework |
| Passwords and hashes | John the Ripper, Hashcat, Hydra |
| Active Directory | BloodHound, Impacket, NetExec |
| Traffic analysis | Wireshark, tcpdump |
| Reporting | CherryTree, Obsidian or plain Markdown notes |
Learn one tool per category well before collecting more. Commercial command-and-control frameworks are not needed for learning and are out of scope for a home lab.
Automate the lab so you can rebuild it
Once you break a lab a few times, you'll want to rebuild it quickly. Three common approaches:
- Snapshots: the simplest option. Revert after every exercise.
- Vagrant: describe VMs and networks in a
Vagrantfile, then runvagrant up. Metasploitable 3 and many AD labs use it. - Ansible or Terraform: useful on Proxmox for building users, services and vulnerable settings the same way every time. This also happens to be good DevOps practice.
Can you build a pentest lab in the cloud?
Yes, but treat it as an add-on to a local lab, not a replacement. AWS, Azure and Google Cloud all let you build a private VPC/VNet with an attacker VM and targets, which is handy if your laptop is weak. Three rules matter:
- Keep vulnerable targets in private subnets with no public IP, and restrict egress with security groups or firewall rules.
- Test only your own resources and follow the provider's penetration testing policy.
- Set a budget alert and shut VMs down after each session. A forgotten Windows VM can quietly run up a bill.
Safety and legal rules for any lab
- Never bridge vulnerable VMs onto your home, office or college network.
- Only test what you own or have written permission to test. Under India's IT Act, 2000, unauthorised access and damage to computer systems carry civil and criminal penalties (Sections 43 and 66).
- Treat downloaded targets as untrusted. Get images from the project's official source and keep them isolated.
- Keep malware analysis separate. Use an internal-only network with no shared folders or clipboard, and revert snapshots afterwards.
- Don't reuse real passwords anywhere in the lab.
Common mistakes and quick fixes
| Problem | Likely cause | Fix |
|---|---|---|
| VMs can't see each other | Different networks, or a firewall on the target | Put both adapters on the same host-only network; check ip -br addr on each |
| VM is very slow or won't start | Virtualisation disabled or Hyper-V conflict on Windows | Enable VT-x/AMD-V; disable conflicting Windows features or use one hypervisor |
| Kali can't update | No NAT adapter, or NAT disabled | Add or reconnect the NAT adapter |
| Laptop runs out of RAM | Too many VMs at once | Run only the VMs the current exercise needs |
| Lab broken after an exercise | No snapshot | Rebuild once, then snapshot before every session |
Your next step
Build the starter lab this week: one Kali VM, one Metasploitable or DVWA target, an isolated network and a baseline snapshot. Work through the scenario table in order and write a short finding for each. If you're aiming for OSCP, read how to pass OSCP on your first attempt next, and when you want guided labs with a trainer reviewing your methodology, look at the OSCP (PEN-200) training.
Related reading
Frequently Asked Questions
What's Your Reaction?
Like
0
Dislike
0
Love
0
Funny
0
Wow
0
Sad
0
Angry
0