WSL2 (Windows Subsystem for Linux, version 2) runs a genuine Linux kernel inside a lightweight, managed Hyper-V virtual machine. Unlike the original WSL1 translation layer, WSL2 gives you full system-call compatibility, real network sockets, and — with a few configuration tweaks — systemd. For a security practitioner that means you can run Kali Linux and its tooling directly on a Windows laptop with none of the overhead of a full VirtualBox or VMware guest and none of the disruption of a dual-boot partition.
This guide covers three complete installation paths: the modern one-command wsl --install method, a manual path for locked-down or older Windows builds that enables each feature by hand, and a Win-KeX GUI setup plus a Docker Desktop alternative for those who want containers on the same backend. It then goes well past install: resource tuning with .wslconfig, boot and systemd control with wsl.conf, VS Code integration, USB Wi-Fi adapter passthrough for wireless testing, disk maintenance, and a troubleshooting table for the errors everyone hits.
Every command targets Kali Linux 2026.x on WSL2 under Windows 11 (Windows 10 21H2+ is also covered). Treat Kali as a loaded firearm: it ships offensive tooling, so keep it patched, keep it off untrusted networks, and only test systems you are authorised to test.
◈ Table of Contents
01 — What WSL2 + Kali Is (and Why It Matters)
CONTEXT
WSL2 boots a real Linux kernel that Microsoft ships and updates through the Microsoft Store package of WSL. Each distribution — Kali, Ubuntu, Debian — is a separate root filesystem stored as an ext4.vhdx virtual disk. All distros share one utility VM, so start-up is near-instant and idle RAM use is small. The trade-off versus a full VMware guest is that WSL2 uses a NAT (or mirrored) virtual network by default and does not expose host hardware such as Wi-Fi radios without extra steps — both of which this guide addresses.
Full Kali Toolset on Windows
Install nmap, Metasploit, Burp Suite, hashcat, BloodHound, and the rest through Kali's own apt repository — no manual porting, no Cygwin, no missing dependencies.
Near-Zero Overhead
The WSL2 VM starts in a second and consumes only what its processes use. You keep Windows as your daily driver and drop into Kali in the same taskbar.
Seamless File Interop
Reach Windows files at /mnt/c from Kali and reach the Kali filesystem at \\wsl$\kali-linux from Explorer. Pipe output between the two worlds freely.
Optional Linux Desktop
Win-KeX layers a full XFCE desktop on top of the WSL instance in window, seamless, or RDP-backed enhanced-session mode when a GUI tool needs a real display.
Disposable Lab Instances
Export a configured Kali to a tarball and re-import it in seconds. Snapshot before a messy engagement, roll back after, or clone identical instances per project.
VS Code Native Dev
The VS Code WSL extension runs its server inside Kali, so you edit and debug exploit code and scripts with Linux paths and Linux Python while the editor UI stays on Windows.
WSL2 ARCHITECTURE — one shared kernel and utility VM hosts each distro's own ext4.vhdx disk.
02 — Prerequisites & Requirements
BEFORE YOU START
WSL2 depends on the Windows Virtual Machine Platform and on hardware virtualization being enabled in firmware. On a modern Windows 11 machine both are usually available; on corporate or older hardware they are the two things you most often have to switch on. Confirm your build first: press Win+R, type winver, and check the version.
| Requirement | Minimum | Recommended | Notes |
|---|---|---|---|
| Windows version | Win 10 21H2 (build 19044) min | Windows 11 23H2+ rec | Win 11 enables one-command install and mirrored networking. Win 10 2004 (19041) is the absolute floor for WSL2. |
| CPU virtualization | VT-x / AMD-V enabled in BIOS | Enabled + nested virt off unless needed | Check Task Manager → Performance → CPU → "Virtualization: Enabled". |
| RAM | 4 GB min | 16 GB+ rec | hashcat, BloodHound and Burp are memory-hungry. Cap WSL RAM in .wslconfig. |
| Disk | 15 GB free | 40 GB+ free (SSD) | kali-linux-large alone is 15 GB+. The vhdx grows on demand and must be compacted manually. |
| Privileges | Local admin for install | Admin + firmware access | Enabling the optional features and hardware virt both require administrator rights. |
Run systeminfo in an admin prompt and check the "Hyper-V Requirements" block. If it says virtualization is enabled in firmware, you are clear. If it reports it disabled, reboot into BIOS/UEFI and enable Intel VT-x or AMD SVM before going further.
Third-party hypervisors and anti-cheat drivers can conflict with the Virtual Machine Platform. VMware Workstation 17+ and VirtualBox 7+ now coexist with WSL2, but some kernel-level anti-cheat and older VMware builds will break it. If WSL2 refuses to start, that conflict is the first suspect.
03 — Method 1: Quick Install (wsl --install)
RECOMMENDED PATHOn Windows 11 and current Windows 10, a single command enables every feature, fetches the WSL kernel, and installs a distro. This is the fastest and least error-prone route. Run everything below in an administrator PowerShell or Windows Terminal.
This installs the WSL platform and its kernel. Passing --no-distribution installs the engine only, so you can then choose Kali explicitly rather than the default Ubuntu.
Reboot if the installer asks. After the reboot, WSL2 is the default backend on Windows 11; on Windows 10 confirm it in the next step.
Force version 2 as the default so any distro you install runs on the real kernel, then list what Kali images are available online.
Pull and register the official Kali WSL image. The download is deliberately small — the base image ships with almost no tools so it stays lightweight; you add metapackages later.
If wsl --list --verbose shows VERSION 1 for Kali, convert it: wsl --set-version kali-linux 2. WSL1 has no real kernel and breaks raw sockets, so many Kali tools will misbehave until you convert.
The first launch runs Kali's setup, which prompts for a non-root username and password. That account is added to sudo. Launch Kali by name from Windows Terminal or run it from PowerShell.
- wsl --list --verbose lists kali-linux at VERSION 2
- You land at a Kali shell prompt as a sudo-capable user
- uname -a reports a Microsoft WSL2 kernel build
04 — Method 2: Manual & Offline Install
LOCKED-DOWN / OLDER WINDOWS
Use this path when wsl --install fails — typically on older Windows 10 builds, on machines without Microsoft Store access, or where a policy blocks the automatic feature enablement. Every step the quick installer does automatically is done here by hand.
WSL2 needs both the WSL feature and the Virtual Machine Platform. Enable them with DISM (works everywhere) or the PowerShell equivalent, then reboot.
On older Windows 10 the in-box kernel is out of date or missing. Download and run the standalone kernel update package, then pin WSL2 as the default.
- 1Download the kernel MSI from
https://aka.ms/wsl2kerneland run it as administrator. - 2On modern Windows, prefer
wsl --updateinstead — it fetches the Store-based kernel automatically.
With the features on, install Kali from the Microsoft Store app, or sideload the appx package on machines where the Store is present but you prefer the CLI.
Keep the downloaded appx/MSI on a USB stick as an offline install kit. On air-gapped assessment laptops that is often the only way to stand Kali up, since wsl --install needs internet to fetch images.
For a truly disconnected build, export an already-configured Kali from another machine to a tarball, copy it across, and import it into a chosen folder. This is also how you relocate an instance off the system drive.
An imported instance logs you in as root by default because import skips first-run setup. Create a normal user and set it as default (shown in Phase 07) — running every tool as root on WSL is a habit that will bite you on a real engagement.
05 — Method 3: Win-KeX Desktop & Docker Backend
GUI & CONTAINERSThe console alone runs most Kali tooling, but some — Burp Suite's UI, GUI BloodHound, Wireshark, browser-based work — want a real desktop. Win-KeX is Kali's official solution: a Kali desktop delivered over TigerVNC or, in enhanced-session mode, RDP. Separately, Docker Desktop can share the same WSL2 backend so you run containers alongside Kali without a second VM.
| Win-KeX mode | Command | Transport | Use when |
|---|---|---|---|
| Window | kex --win -s |
VNC | You want the full XFCE desktop in one resizable window |
| Seamless | kex --sl -s |
VNC | You want individual Kali apps floating on the Windows desktop |
| Enhanced Session | kex --esm --ip -s |
RDP | You want the richest, highest-fidelity desktop experience |
Win-KeX ships as the kali-win-kex package. Update first, then install. Do this inside the Kali shell, not PowerShell.
Window mode opens the full XFCE desktop in a single, resizable window. The -s flag adds sound support. The first run prompts you to set a VNC password used for the local display session.
Seamless mode drops the desktop shell and floats individual Kali windows directly on your Windows desktop, so a tool like Wireshark appears as if it were a native app.
Seamless mode is the most productive default for day-to-day work: you keep the Windows taskbar and only summon the Kali GUI apps you actually need, instead of context-switching into a whole second desktop.
Enhanced Session Mode (ESM) delivers the desktop over RDP for a richer, higher-fidelity experience similar to Hyper-V enhanced sessions. The --ip flag is the documented ARM workaround; keep -s for sound.
To shut a session down, close the Win-KeX window, or from the Kali shell run kex --stop. Use kex --help to see every flag your installed version supports.
If you also want containers, install Docker Desktop for Windows and enable its WSL2 integration. Docker then runs its engine in the shared WSL2 backend and exposes the docker CLI inside Kali — no Docker install inside Kali required.
- 1Install Docker Desktop, then open Settings → General and confirm "Use the WSL 2 based engine" is ticked.
- 2Open Settings → Resources → WSL Integration and toggle on
kali-linux. - 3Restart Docker Desktop, then test the CLI from within Kali.
06 — First-Run Configuration & Installing Tools
MAKE IT USEFULAlways fully update on first launch — the base image lags the repo. Then set the root password (needed for a few tools) and, if you imported and are stuck as root, create a proper user.
The WSL image is intentionally bare. Metapackages pull in curated tool bundles. Pick based on disk budget: default matches the standard Kali image, large adds far more, headless skips GUI apps (ideal for a console-only WSL box), and everything is enormous.
| Metapackage | Approx. size | Best for |
|---|---|---|
| kali-linux-headless | ~4 GB | Console-only WSL; no GUI tools pulled in |
| kali-linux-default | ~9 GB | The standard Kali toolset most guides assume |
| kali-linux-large | ~15 GB+ | Default plus a large extra tool set |
| kali-tools-top10 | ~2 GB | Just the ten most-used tools for a light box |
Do not blindly install kali-linux-everything on a laptop — it can exceed 40 GB and will balloon the ext4.vhdx. That space is not automatically returned to Windows when you later remove packages; you must compact the disk manually (Phase 10).
You can always cherry-pick. Kali packages the whole offensive catalogue, so a headless box plus a handful of named tools is often the leanest setup.
- nmap --version and msfconsole both launch without errors
- searchsploit returns results from an updated local database
- Your chosen metapackage installed with no held/broken packages
Metasploit needs its PostgreSQL database initialised once: run sudo msfdb init (systemd must be enabled — see Phase 07). Without it, db_status in msfconsole reports no connection and workspace features are unavailable.
Fix the small things that cause noisy warnings: locale, timezone, and confirming ZSH (Kali's default shell) is active for your user.
07 — Core Configuration: .wslconfig & wsl.conf
THE SETTINGS THAT MATTER
Two files control almost everything. %UserProfile%\.wslconfig on the Windows side controls the whole WSL2 VM — RAM, CPUs, swap, networking mode. /etc/wsl.conf inside Kali controls that distro — systemd, default user, mount behaviour, interop. Get these right once and the rest of your setup falls into place.
Left unbounded, WSL2 will claim a large share of RAM. Create .wslconfig in your Windows user profile to cap it. Edit from Kali via the /mnt/c path or from Windows in Notepad.
| Key | Effect | Typical value |
|---|---|---|
| memory | Max RAM the utility VM can use | 50–75% of host RAM |
| processors | Logical CPUs exposed to Linux | Half your core count |
| swap | Swap file size (0 = off) | 2–4GB |
| networkingMode | nat (default) or mirrored | mirrored on Win 11 22H2+ |
| autoMemoryReclaim | Returns cached RAM to Windows | gradual |
Modern WSL supports systemd, which many Kali services (PostgreSQL for Metasploit, Docker-in-Kali, bluetooth, ssh) expect. Turn it on in /etc/wsl.conf and, if you imported as root, set your normal user as the default login.
After enabling systemd, manage services the normal way: sudo systemctl enable --now ssh or sudo systemctl start postgresql. Before systemd, Kali on WSL relied on service shims — those still work but native units are cleaner.
If DNS resolution breaks after editing configs (a common symptom of a stale /etc/resolv.conf), confirm the setting and let WSL regenerate it.
08 — Windows Integration: Terminal, VS Code, Files
TWO WORLDS, ONE WORKFLOWInstalling Kali auto-adds a Windows Terminal profile. Set it as your default or bind a hotkey so Kali is one keystroke away.
- 1Open Windows Terminal → Settings (Ctrl+,) → Startup → set default profile to Kali if you like.
- 2Under the Kali profile → Appearance, pick a scheme; the "Kali" preset ships with recent Terminal builds.
- 3Launch a specific working directory:
wsl -d kali-linux --cd ~.
The VS Code WSL extension runs the editor's backend inside Kali, so extensions, the integrated terminal, the debugger and Python all use the Linux environment while the window stays on Windows.
- 1In Windows VS Code, install the WSL extension (publisher: Microsoft).
- 2From a Kali shell, change into a project and launch the editor bound to Kali.
Keep engagement code and notes inside the Kali filesystem (~/), not under /mnt/c. Cross-OS file access over the 9P protocol is markedly slower, and Linux permission bits are not preserved on the Windows drive.
Windows drives mount under /mnt inside Kali; the Kali filesystem is reachable from Explorer via the \\wsl$ UNC path. Use them to move loot, wordlists and reports between the two sides.
With interop enabled, you can call Windows executables from Kali. This is handy for opening report artifacts or pushing text to the Windows clipboard.
Interop means Kali can execute Windows binaries in your user context. Treat that as a real trust boundary: never pipe untrusted, attacker-controlled data into cmd.exe, powershell.exe or clip.exe — it crosses straight back into Windows.
09 — Advanced: USB Wi-Fi, Networking & GPU
POWER-USERWSL2 does not expose the host Wi-Fi radio, so wireless auditing needs an external adapter passed through with usbipd-win. Install it on Windows, then bind and attach the device to Kali.
Monitor mode and packet injection also require the adapter's chipset driver to be present in the WSL2 kernel. The stock Microsoft kernel omits many wireless drivers — you may need a custom-compiled WSL2 kernel for monitor mode. Confirm chipset support before relying on this for an engagement.
Default NAT gives Kali its own subnet, which complicates reverse shells and inbound listeners. Mirrored mode makes WSL share the host's network interfaces and IPs, so a listener on Kali is reachable at the Windows IP.
In mirrored mode you can reach a Windows-hosted service from Kali via localhost and vice-versa, without the old host.docker.internal or gateway-IP gymnastics. It is the single biggest quality-of-life upgrade for running listeners on WSL.
WSL2 supports GPU compute passthrough. With a current NVIDIA or AMD Windows driver installed, hashcat inside Kali can use the GPU with no extra driver install inside Linux — the vendor driver is projected in.
Install the GPU driver on Windows, not inside Kali. Installing a Linux NVIDIA driver in WSL overwrites the projected libraries and breaks GPU access. If hashcat -I shows only the CPU, update the Windows GPU driver and run wsl --update.
10 — Maintenance & Troubleshooting
KEEP IT HEALTHYUpdate the distro from inside Kali and the WSL engine from Windows. Snapshot before risky work by exporting the whole instance to a tarball you can re-import.
The ext4.vhdx grows as you install tools but does not shrink when you remove them. Reclaim space by compacting it. With sparseVhd enabled (Phase 07) WSL reclaims some automatically; for a manual compaction use one of the following.
Find the exact vhdx path with (Get-ChildItem -Path $env:LOCALAPPDATA\Packages -Recurse -Filter ext4.vhdx).FullName in PowerShell. The Kali package folder name starts with KaliLinux.
The overwhelming majority of WSL2 problems come from a handful of causes: features not enabled, virtualization off, a stale kernel, or config typos. This table maps the message you see to the fix.
| Symptom / Error | Cause | Fix |
|---|---|---|
| WslRegisterDistribution failed 0x80370102 | Virtualization disabled or VM Platform off | Enable VT-x/AMD-V in BIOS; run the DISM feature commands (Phase 04); reboot |
| Error 0x800701bc / kernel too old | Missing or outdated WSL2 kernel | Run wsl --update, or install the MSI from aka.ms/wsl2kernel |
| Kali stuck at VERSION 1 | Default version was 1 at install | wsl --set-version kali-linux 2 then wsl --set-default-version 2 |
| No DNS / name resolution fails | Stale or overwritten /etc/resolv.conf | Set generateResolvConf=true in wsl.conf, or write your own nameserver |
| systemctl: "failed to connect to bus" | systemd not enabled | Add [boot] systemd=true to wsl.conf; wsl --shutdown |
| Win-KeX: black screen / no display | VNC session state or missing sound flag | kex --stop then relaunch with -s; run kex --help |
| Disk full on C: but tools removed | vhdx does not auto-shrink | Compact the disk (Step 2 above) |
| hashcat -I shows CPU only | Old Windows GPU driver or WSL engine | Update the Windows GPU driver + wsl --update; never install a Linux GPU driver in WSL |
wsl --unregister permanently deletes that distro's entire filesystem, including your home directory and any engagement data. Always wsl --export first. There is no recycle bin for this.
11 — Sources & References
DOCUMENTATION◈ Turn This Lab Into a Skillset
A Kali WSL2 box is the launchpad — the next step is knowing what to point it at. CyberHawk Threat Intel publishes hands-on guides for the whole offensive toolchain: Nmap, Metasploit, hashcat, BloodHound and Active Directory attack paths, all built on the same lab you just stood up.
📝 More Hands-On Guides 📚 Browse Courses◈ Stay Connected
Follow CyberHawk Threat Intel for threat intelligence, deployment guides and hands-on SOC tooling content.
"They can't exploit you if you are the Exploit."