I have always been a Windows user, mostly because I enjoy playing video games in my free time and having a virtual machine to study and code was working fine for me on my personal PC.
But ever since Microsoft introduced WSL I was wondering if I could change my workflow and create the “ultimate” setup on my Windows machine. When WSL2 for Windows was introduced, I decided to make the best out of it. The main issue with going down this path is ditching your favorite virtualization environment (e.g. VirtualBox, VMware) and switch to Hyper-V. I won’t go in much detail about the advantages and disadvantages of each virtualization system but to the best of my knowledge, installing a virtual machine on Hyper-V is a “pain in the ass”.
This blogpost is not meant to be an all-in depth tutorial on how to install everything, but rather a walkthrough on why I installed every utility and how I customized it to suit my needs. Nevertheless, I will provide links to everything I used for everyone who wants to try out my setup or parts of it.
Anyway, let’s talk about what my current/final setup is. I have installed WSL2 with two OSes (Ubuntu and Kali) which are in NAT mode with my main OS. To install WSL2 you can follow Microsoft’s
instructions. The reason why I have two Linux machines is because I use my Ubuntu mainly for software development and the Kali machine to enhance my pentest experience on my Windows machine without opening an additional graphical virtual machine. I must point out that to enable WSL2 you have to have
Windows 10 build 18917 or higher installed. At the time of writing, the build is available on the Windows Insider Program.
The next thing in the list is Docker. The Docker installation is straightforward, all you have to do is to download and install it from their
website. One of the most exciting features is that you can enable the WSL2 based engine which leverages the dynamic memory allocation feature in WSL2 to greatly improve the resource consumption. For more information and how to enable it visit this
link.
As my only option for virtualization now is Hyper-V, I have created a Kali Linux VM in bridge mode. As this is my home machine, I don’t actually use it in my pentest engagements, but it is helpful anyway, especially for studying, testing and doing research work. You can either download the
ISO or the Hyper-V
image . If you prefer to install the ISO a detailed installation tutorial can be found
here. After the initial installation, the Enhanced Session Mode (similar to VirtualBox guest additions) must be enabled to improve your virtual experience. The Kali Linux website posted an article with all the details in the following
link. The last thing to do is to create a shared folder between your host and kali using one of the two methods described in this
blogpost. Personally, I preferred the first method which shares a drive with the guest OS.
To enhance my Hyper-V experience, I installed
Vagrant to spin up virtual machines to my hypervisor automatically, in case I need something extra. The only issue here is that there aren’t as many supported boxes on Hyper-V as on the other virtualization programs.
Lastly, I have enabled
Microsoft Sandbox, which might be useful when you need a temporary Windows machine.