Setting Up Your Kali Linux & Virtual Hacking Lab
Learn how to configure an isolated, safe virtualized environment to practice offensive hacking safely and legally.
Install VirtualBox and Extensions
Download and run the VirtualBox installer for your OS. Be sure to also download and install the **VirtualBox Extension Pack** to enable full USB device and network interface driver capabilities.
Create the Kali Linux Virtual Machine
Open VirtualBox, click **New**, and specify the following configurations:
- Name: Kali-Pentester
- Type: Linux, **Version:** Debian (64-bit)
- Base Memory: 4096MB (4GB)
- Processors: 2 vCPUs
- Virtual Disk: Create a virtual hard disk (VDI) of 30GB (dynamically allocated)
In **Settings** > **Storage**, attach your Kali Linux ISO to the Virtual Optical Drive, then launch the VM and proceed with the standard graphic installation.
Configure the Host-Only/NAT Network
To keep your hacking lab safely isolated from your main home network while allowing internet access inside VMs for updates, configure two network adapters in both VMs:
- Adapter 1: NAT (For internet connection to update tools)
- Adapter 2: Host-Only Adapter (e.g., `vboxnet0` - For safe, isolated VM-to-VM interaction)
Import and Launch Metasploitable 2
Download the Metasploitable2 ZIP, extract it, and import the `.vmdk` file into VirtualBox as a new Linux virtual machine. In **Settings** > **Network**, attach it **only** to the Host-Only Adapter (Adapter 2) so it remains inaccessible from the internet due to its intentional extreme vulnerability.
Run both VMs and verify communication by running a ping from Kali to Metasploitable:
ping -c 4 <metasploitable_host_only_ip>