Skip to main content

WSL: Networking in Mirrored Mode

(2026-07-02)

OnEnable machinesMirrored runningNetworking

Windows

Edit 11.wslconfig

22H2

Open and(or highercreate) youthe canfile setat:

networkingMode=mirrored

C:\Users<YourUser>.wslconfig

Add the following under [wsl2]:

in
[wsl2]
networkingMode=mirrored
dnsTunneling=true
autoProxy=true
Copy
Save the .wslconfigfile.
file
to enable mirrored mode networking. Enabling this changes

Restart WSL to an entirely new networking architecture which has the goal of 'mirroring' the network interfaces that you have on Windows into Linux, to add new networking features and improve compatibility.

Access from outside:

Run the following command in PowerShell window(Admin): with

wsl admin--shutdown

privileges

Then reopen your Linux distro.

Configure Firewall for Inbound Connections To allow LAN access to ConfigureWSL Hyper-Vservices:

firewall settings to allow inbound connections:

Set-NetFirewallHyperVVMSetting -Name '{40E0AC32-46A5-438A-A0B2-2B479E8F2E90}<VM-ID>}' -DefaultInboundAction Allow

orOr create a specific inbound rule:

New-NetFirewallHyperVRule -Name "MyWebServer"WSLWeb" -DisplayName "MyWSL Web Server" `-Direction Inbound -VMCreatorId '{40E0AC32-46A5-438A-A0B2-2B479E8F2E90}' -Protocol TCP -LocalPorts 80 `-VMCreatorId '{<VM-ID>}'

(sourceReplace <VM-ID> with your WSL VM ID from Get-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.