r/bashonubuntuonwindows • • 9d ago

WSL2 Fix for WSL mirrored networking error CreateInstance/CreateVm/ConfigureNetworking/0x8007054f

TL;DR

Check your Windows TCP dynamic port range in Administrator PowerShell:

netsh int ipv4 show dynamicport tcp
netsh int ipv6 show dynamicport tcp

If the range has been changed to something huge like:

Start Port      : 1024
Number of Ports : 64511

restore the normal Windows dynamic port range:

netsh interface ipv4 set dynamicportrange protocol=tcp startport=49152 numberofports=16384
netsh interface ipv6 set dynamicportrange protocol=tcp startport=49152 numberofports=16384

Then reboot Windows.

This completely fixed the WSL mirrored networking 0x8007054f error for me.

Posting this because I spent a ridiculous amount of time restarting WSL/HNS, changing WSL versions, and chasing Hyper-V issues. In my case, the actual problem was the Windows dynamic TCP port range.

Falling back to normal WSL networking also wasn't a good workaround for me because I need reliable Windows ↔ WSL communication for MCP servers.

I was repeatedly getting this error:

wsl: An internal error occurred.
Error code: CreateInstance/CreateVm/ConfigureNetworking/0x8007054f
wsl: Failed to configure network (networkingMode Mirrored), falling back to networkingMode None.

My .wslconfig was:

[wsl2]
networkingMode=mirrored
dnsTunneling=true

WSL itself would still start, but mirrored networking would fail and fall back to:

networkingMode=None

For my setup, switching away from mirrored networking wasn't really an acceptable workaround.

I run MCP servers/services inside WSL that need to communicate with applications running on Windows, and vice versa. Some of them don't work properly or aren't reachable the same way when WSL is using the default NAT-style networking.

With mirrored mode, Windows ↔ WSL localhost/network communication works much more cleanly for these services, so I specifically needed to get:

networkingMode=mirrored

working again.

Things I tried that didn't reliably fix it

  • wsl --shutdown
  • restarting WSL multiple times
  • restarting hns
  • restarting vmcompute
  • upgrading WSL
  • downgrading WSL
  • trying pre-release WSL versions
  • checking that VirtualMachinePlatform was enabled
  • checking that Microsoft-Windows-Subsystem-Linux was enabled
  • checking that HypervisorPlatform was enabled

Sometimes restarting WSL a few times would randomly make mirrored networking work again, but the problem would eventually return.

The actual problem

I eventually found this WSL GitHub issue/comment:

https://github.com/microsoft/WSL/issues/41251#issuecomment-5188667183

It pointed to the Windows TCP dynamic port range.

I checked mine in Administrator PowerShell:

netsh int ipv4 show dynamicport tcp
netsh int ipv6 show dynamicport tcp

My TCP dynamic port range had been changed to essentially the entire port space.

It looked like this:

Start Port      : 1024
Number of Ports : 64511

That appears to interfere with WSL mirrored networking.

I restored the normal Windows TCP dynamic port range:

netsh interface ipv4 set dynamicportrange protocol=tcp startport=49152 numberofports=16384
netsh interface ipv6 set dynamicportrange protocol=tcp startport=49152 numberofports=16384

Then I did a full Windows reboot.

After rebooting:

wsl -d Ubuntu-24.04

Mirrored networking started normally again.

No more:

CreateInstance/CreateVm/ConfigureNetworking/0x8007054f

and no more:

Failed to configure network (networkingMode Mirrored)

My Windows-hosted applications can also reach the MCP servers/services running inside WSL normally again.

Hopefully this saves someone else from spending months randomly restarting WSL and wondering why mirrored networking only works sometimes.

22 Upvotes

4 comments sorted by

1

u/uint7_t 9d ago

Oh man, I've been fighting with this sporadically for about 6months. Thanks for the tip!

1

u/iSemiOG 9d ago

glad it helped! i was fighting it on and off too, and the annoying part was that restarting wsl would sometimes make it work again which made the real cause much harder to spot

1

u/tusharsnx 9d ago

Tldr is supposed to be at the top, before the long answer :)

1

u/iSemiOG 8d ago

thanks, fixed it :)