Skip to main content

WSL: Networking in Mirrored Mode

(2026-07-02)

Enable Mirrored Networking

Edit .wslconfig

Open (or create) the file at:

C:\Users<YourUser>.wslconfig

Add the following under [wsl2]:

[wsl2]
networkingMode=mirrored
dnsTunneling=true
autoProxy=true
Copy
Save the file.

Restart WSL Run in PowerShell (Admin):

wsl --shutdown

Then reopen your Linux distro.

Configure Firewall for Inbound Connections To allow LAN access to WSL services:

Open everything:

Set-NetFirewallHyperVVMSetting -Name '{<VM-ID>}' -DefaultInboundAction Allow

Or create a specific inbound rule:

New-NetFirewallHyperVRule -Name "WSLWeb" -DisplayName "WSL Web Server" `-Direction Inbound -Protocol TCP -LocalPorts 80 `-VMCreatorId '{<VM-ID>}'

(ReplaceUse <VM-ID>the withPowerShell yourcommand WSLhcsdiag list | Select-String "WSL"  to find the VM ID fromof Get-the WSL VM.)

Verify Connectivity

From Windows → Linux: Access Linux services via localhost (e.g., http://127.0.0.1:5000).

From Linux → Windows: Access Windows services via localhost as well.

Test IPv6 with:

ping6 ::1 Copy

Best Practices

Ensure HNS, vmcompute, and vmms services are running:

Get-Service hns, vmcompute, vmms

Disable IPv6 on the WSL virtual adapter if you face random disconnects due to router issues.

Use mirrored mode instead of NAT for simpler networking and fewer IP lookups.

With mirrored networking enabled, you no longer need to manually find IP addresses—localhost works both ways between Windows and WSL.