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.

Jul 08, 2025 - 14:43
Updated: 29 days ago
122.8k
How to Set Up a Penetration Testing Lab in 2026: Tools, OS, Network Topology and Practice Scenarios

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 sizeRAMCPUStorageWhat it runs at once
Starter8 GB4 cores150 GB SSDKali + one light Linux target
Comfortable16 GB4 to 6 cores250 to 500 GB SSDKali + 2 or 3 Linux/web targets
Active Directory32 GB or more8 cores1 TB NVMeKali + 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.

PlatformCost (2026)Runs onBest for
VirtualBoxFree, open sourceWindows, Linux, macOS (Intel and Apple silicon)Beginners, simple host-only networks
VMware Workstation Pro / Fusion ProFree for personal, educational and commercial use since November 2024 (Broadcom notice)Windows, Linux (Workstation); macOS (Fusion)Stable desktop labs with flexible virtual networks
Hyper-VIncluded in Windows Pro, Enterprise and EducationWindows hostsWindows-heavy and AD labs
Proxmox VEFree, 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

TargetWhat you practiseNotes
Metasploitable 2Network service enumeration and classic exploitsVery old and extremely insecure. Host-only network only, never bridged.
Metasploitable 3Windows and Linux service flawsBuilt with Vagrant/Packer; heavier but more realistic
DVWA, OWASP Juice ShopWeb vulnerabilities (SQL injection, XSS, broken authentication)Run as Docker containers on a small Ubuntu VM
VulnHub-style VMsFull "boot to root" practiceDownload only from trusted sources and scan the image first
Windows Server evaluation + Windows clientsActive Directory enumeration and misconfigurationsMicrosoft offers time-limited evaluation editions for lab use
Security Onion or WazuhDetection 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 modeWhat it doesUse in the lab
NATVM reaches the internet through the host; nothing can reach inKali only, for updates. Disconnect it during exercises if you like.
Host-onlyVMs talk to each other and the host, not to the internetMain lab network
Internal networkVMs talk only to each other, not even the hostExtra-isolated segments, malware analysis
BridgedVM sits directly on your home or office networkAvoid 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

  1. Enable virtualisation. Turn on Intel VT-x or AMD-V in BIOS/UEFI, then install VirtualBox or VMware Workstation Pro.
  2. 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.
  3. 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.
  4. Add a target. Import Metasploitable 2 (or build an Ubuntu VM running DVWA in Docker) with a single host-only adapter and no NAT.
  5. Check isolation. From the target, a ping to the internet should fail. From Kali, the target should answer.
  6. Snapshot everything. Take a clean "baseline" snapshot of every VM before you touch it.
  7. 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.

ScenarioTargetSkillsDefensive takeaway
Recon and enumerationMetasploitable 2Nmap, service versions, banner grabbingClose unused services, patch old versions
Web application testingDVWA, Juice ShopBurp Suite or OWASP ZAP, input validation flawsParameterised queries, output encoding
Password securityLab Linux accounts you createWeak password policy, hash formats, John the RipperStrong policy, MFA, lockout and monitoring
Privilege escalationLinux and Windows targetsMisconfigured sudo, services and permissionsLeast privilege, hardening baselines
Active DirectoryYour own small domainEnumeration, weak service accounts, Kerberos basicsTiered admin model, strong service account passwords
DetectionSecurity Onion or WazuhFind your own scans and logins in the logsWrite 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

CategoryTools (all available in Kali)
Scanning and enumerationNmap, Netcat, enum4linux-ng, Nikto
Web testingBurp Suite Community, OWASP ZAP, ffuf, sqlmap
Exploitation frameworkMetasploit Framework
Passwords and hashesJohn the Ripper, Hashcat, Hydra
Active DirectoryBloodHound, Impacket, NetExec
Traffic analysisWireshark, tcpdump
ReportingCherryTree, 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 run vagrant 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

ProblemLikely causeFix
VMs can't see each otherDifferent networks, or a firewall on the targetPut both adapters on the same host-only network; check ip -br addr on each
VM is very slow or won't startVirtualisation disabled or Hyper-V conflict on WindowsEnable VT-x/AMD-V; disable conflicting Windows features or use one hypervisor
Kali can't updateNo NAT adapter, or NAT disabledAdd or reconnect the NAT adapter
Laptop runs out of RAMToo many VMs at onceRun only the VMs the current exercise needs
Lab broken after an exerciseNo snapshotRebuild 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

A penetration testing lab is an isolated set of virtual or physical machines that you own, built so you can practise scanning, exploitation, defence and reporting safely. It usually has one attacker machine such as Kali Linux and one or more deliberately vulnerable targets.

16 GB is comfortable for Kali plus two or three Linux or web targets. You can start with 8 GB by running one target at a time. An Active Directory lab with a domain controller and Windows clients realistically needs 32 GB or more.

Both work well. VirtualBox is free and open source, and VMware Workstation Pro has been free for personal and commercial use since November 2024. Choose the one that runs best on your hardware, and use Proxmox if you have a dedicated lab machine.

Vulnerable targets should not be. Put them on a host-only or internal network with no internet access, and give only the Kali VM a separate NAT adapter for updates. Never bridge vulnerable machines onto your home or office network.

Yes. Building and attacking machines you own is legal. The law is broken when you test systems you don't own or lack written permission for, which can bring penalties under Sections 43 and 66 of the IT Act, 2000.

Yes. Install a Windows Server evaluation edition as a domain controller, join one or two Windows clients, and practise enumeration and common misconfigurations. Projects such as GOAD automate a larger vulnerable AD lab but need plenty of RAM.

A home lab builds the fundamentals, but OSCP preparation also needs the official PEN-200 labs and timed practice on a range of unfamiliar machines. Use your own lab to drill enumeration, privilege escalation, Active Directory basics and report writing.

Yes. AWS, Azure and Google Cloud let you build a private network with an attacker and targets. Keep targets without public IPs, restrict outbound traffic, follow the provider's testing policy, and set budget alerts so idle VMs don't run up costs.

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Wow Wow 0
Sad Sad 0
Angry Angry 0
Vaishnavi

Vaishnavi is a skilled tech professional at the Ethical Hacking Training Institute in Pune, responsible for managing and optimizing the technical infrastructure that supports advanced cybersecurity education. With deep expertise in network security, backend operations, and system performance, she ensures that practical labs, online modules, and assessments run smoothly and securely. Her behind-the-scenes contributions play a vital role in delivering a seamless and secure learning experience for aspiring ethical hackers.