๐ก๏ธ A penetration testing lab is a safe, isolated environment for ethical hackers to learn and test exploits without any risk to real networks or legal issues.
๐ฅ๏ธ Step 1: Choose a Virtualization Platform
Tool of Choice: Oracle VirtualBox
- โ Free & open-source
- ๐ก Works on Windows, Linux, macOS
- ๐ Alternatives: VMware Workstation, Hyper-V, KVM
๐ฆ Step 2: Download Required ISO / VM Files
VM Role | OS/Tool | Download Link |
---|---|---|
Attacker | Kali Linux (Latest) | kali.org |
Target (Vuln) | Metasploitable 2 | SourceForge |
๐งฐ Step 3: Install Kali Linux (Attacker Machine)
- Open VirtualBox โ
New VM
โ Name: Kali Linux - Type:
Linux
, Version:Debian (64-bit)
- Assign:
- RAM: 2 GB minimum
- Disk: 20 GB (Dynamically Allocated)
- Mount Kali ISO and boot.
- Follow GUI installation:
- Create user
- Choose mirror (optional)
- Partition and install
- After boot, update system:
sudo apt update && sudo apt upgrade -y
- Install basic tools:
sudo apt install net-tools curl vim git proxychains nmap
๐ฏ Step 4: Import Metasploitable 2 (Target Machine)
-
Download
.ova
โ VirtualBox โFile
โImport Appliance
-
Set:
- RAM: 512 MB
- Network: Host-only Adapter (same as Kali)
-
Boot & login:
Username: msfadmin
Password: msfadmin
๐ Step 5: Network Configuration
Ensure both VMs are on the same Host-only Adapter:
-
Go to Settings โ Network:
- Kali: Adapter 1 โ Host-only Adapter โ vboxnet0
- Metasploitable: Same
๐ฅ๏ธ Verify Network:
# On Kali
ip a
# Ping Metasploitable
ping 192.168.56.102
Use
ifconfig
orip a
on both machines to get the IPs.
๐ธ Step 6: Take Snapshots
After installing each VM:
- Go to
Snapshots
in VirtualBox - Click
Take Snapshot
- Name it:
Clean Install
๐ Snapshots allow you to revert VMs after running exploits or malware tests.
๐งท Step 7: Guest Additions + Enhancements (Optional)
Install Guest Additions on Kali:
sudo apt install virtualbox-guest-x11
Enable Drag & Drop and Shared Clipboard:
- VM Settings โ General โ Advanced โ Set both to
Bidirectional
๐๏ธ Suggested Lab Folder Structure
~/Pentest-Lab/
โโโ Notes/
โโโ Reports/
โโโ Payloads/
โโโ Tools/
Clone helpful tools:
git clone https://github.com/carlospolop/PEASS-ng
git clone https://github.com/rebootuser/LinEnum
๐ง Final Lab Topology Diagram
+----------------------+ +------------------------+
| Kali Linux VM | <-------> | Metasploitable 2 VM |
| (Attacker Toolkit) | Host-only | (Vulnerable Target) |
| IP: 192.168.56.101 | Network | IP: 192.168.56.102 |
+----------------------+ +------------------------+
โ
VirtualBox Host
(Your System)
๐ง Pro Tips & Blue Team Notes
- ๐ Keep your lab offline: Use Host-only or Internal networks.
- ๐ฅ Always snapshot before running malware or privilege escalation exploits.
- ๐งโ๐ป Install useful enumeration tools early on.
- ๐ Revert VMs after each pentest session for repeatability.
โ Key Takeaways
-
You now have a fully isolated lab with:
- โ Kali Linux (attacker)
- โ Metasploitable 1 (target)
-
This is your playground to practice:
- Nmap scans
- Exploits via Metasploit
- Manual recon and enumeration
๐ฌ Got questions or suggestions? Comment below or reach out on LinkedIn. Stay tuned for more ethical hacking labs!