Hi Pentesters, while pursuing the course on Ethical Hacking and Penetration Testing, we often feel the need to have our own pentesting lab to practice all the stuff we're learning during the course. I am no exception, so I began searching for a way I could do this. After gathering some info, I found a way and wanted to share it with you.Prerequisites:
- A Windows or Linux host machine. In this tutorial, I'm using Windows 10 as the host.
- Minimum of 8 GB RAM (recommended).
- Virtualization enabled in your BIOS - look for vt-d and enable it.
- Check you system and OS architecture (whether it's 32-bit or 64-bit) and download VirtualBox and Kali ISO according to that architecture.
- VirtualBox installed. It's free, open source and safe. Download it here:https://www.virtualbox.org/wiki/Downloads
- Kali Linux 2.0 ISO image. Get it here: https://www.kali.org/downloads/Note: You can use any OS ISO image file of your choice.
- A few Networking basics.
Let's start...Step 1: Open VirtualBox
Step 2: Select File>Preferences>Network>Host-only Network Tab. Check that you have “VirtualBox Host-Only Ethernet Adapter” - present or not. If not, create one by clicking the plus sign on the right side. VirtualBox Host-Only Adapter emulates the functionality of a physical Ethernet switch. Virtual machines can talk to each other and the host, as if they were connected.
Step 3: Select VirtualBox Host-Only Adapter and Click settings.
Check out the default settings below. You can change it if you want. I won't.
Check the DHCP server tab and it's default settings. Make sure it's enabled.
Step 4: Create a Virtual Machine by clicking New on the VirtualBox welcome window.Select Type = Linux, Version = Other Linux (64-bit)/Other Linux (32-bit), depending on your ISO. I'm mounting Kali on it, so I'm typing Name = Kali Guest 01. Click on Next.
Step 5: Set Memory size of 2 GB or 3 GB. I'm setting 3GB. Click Next.
Step 6: Create a virtual hard disk now and click Create.
Step 7: Choose VDI. Click Next.
Step 8: Select Dynamically allocated for Storage on Physical hard disk. Click Next.Step 9: Keep the Defaults on File Location and size Window and click Create.
Step 10: You'll see this screen. Select the Virtual machine and click Settings.
Step 11: Select Network section on the Settings Window and the Adapter 1 tab. Enable it if it's not and Select Attached to = Host-only Adapter. Select Name = VirtualBox Host-Only Ethernet Adapter. Keep the defaults for the rest. Click the refresh button beside the MAC Address Textbox several times making sure it produced a unique MAC Address. Also, make sure the cable connected check box is enabled.
Step 12: Click the Adapter 2 Tab and Check the Enable Network Adapter Check box. SelectSelect Attached To = NAT to connect to the internet through your host machine.
Step 13: You can also share some folders later.Step 14. Go to the Storage section and right-click on the default .vdi entry and click Remove attachment. Then, select the entry called “Empty”. Next, go to Attributes and click on the CD icon. Select Choose Virtual Optical Disk File and select Kali image for sake of this tutorial.
Click Open and it will look like this. Click OK.
Step 15: Go to Display and select at least 48 MB of Video memory, which will be enough.
Step 16: Everything else is fine. Next, clone the Virtual machine. Yes, just clone it - with a different name, of course.
Step 17: Give the machine name "Kali Guest 02" and DON'T FORGET to check the Reinitialize the MAC address of all network cards. Click Next.
Step 18. Choose Full Clone and click Clone.
Step 19: It will look like this.
Start both machines by selecting Live at the Boot menu.
Here's a screen shot of Kali Guest 01 and the ifconfig command fired.
For the second one, check the IP's are different because we have enabled the DHCP server previously.
Step 21: Ping each other and ping the internet servers.
Ping from the host machine. I wasn't gonna show the pinging of Host from virtual machine - everyone is Hacker here. LOL.
Scan another virtual machine with Sparta.
That's how you can set up a Virtual Penetration Testing Lab in your home. See you, Peace.