WSL: Error code: Wsl/Service/CreateInstance/CreateVm/ConfigureNetworking/HNS/ERROR_UNHANDLED_EXCEPTION

Windows Version

Microsoft Windows [Version 10.0.19045.4170]

WSL Version

2.1.5.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

5.15.146.1-2

Distro Version

Ubuntu (22.04)

Other Software

No response

Repro Steps

I was trying to setup LAN Network Bridge in ‘Network and Sharing Center’ again after hardware change forced windows 10 reset, then suddenly lost networking ability in WSL. I’ve tried suggested fixes from the following issue#: #10709 #10495 #10755 #10764, none of which have worked besides creating a .wslconfig file, and setting networkingMode=none

[experimental]
autoMemoryReclaim=gradual  # gradual | dropcache | disabled
networkingMode=none       # mirrored | NAT | None 
#dnsTunneling=false
#firewall=false
#autoProxy=true
#[wsl2]  # omit that if you already have it. 
#networkingMode=bridged
#vmSwitch=wsl_switch

Expected Behavior

image

Actual Behavior

image

Diagnostic Logs

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 26 (7 by maintainers)

Most upvoted comments

Sorry, it looks like your Hyper-V configuration is in some broken state. I would recommend removing all Hyper-V related features, then adding them back to get into a known working state. This does mean that if you have VMs, you’ll want to ensure they are backed up correctly first.

Same with your Linux distros. (always good to have backups!)

That would mean removing the optional components for Hyper-V, Virtual Machine Platform, Windows Sandbox, Microsoft Defender Application Guard, Windows Subsytem for Linux.

@alohith, Were you able to get this resolved? I’m no expert on this, but I’ll share a couple things that worked for me. Hopefully it helps someone. In both these solutions I have the following Windows features enabled: Hyper-V, Virtual Machine Platform, and Windows Subsystem for Linux. As a side note, I also have NordVPN running and both the following solutions still worked.

This documentation helped me, WSL Networking Documentation

Host Machine: Window 11 23H2 22631.3296

My wsl

wsl --version
WSL version: 2.1.5.0
Kernel version: 5.15.146.1-2
WSLg version: 1.0.60
MSRDC version: 1.2.5105
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22631.3296

My .wslconfig. - Your config doesn’t need all these setting, but add them as needed.

[wsl2]
dnsTunneling=true
firewall=true
networkingMode=mirrored # bridged, mirrored, nat, none, virtioproxy
# vmSwitch=Hyper-V # Required with networkingMode=bridged 

[experimental]
autoMemoryReclaim=gradual  # disable, dropcache, gradual
sparseVhd=true
  1. Solution - Mirrored
[wsl2]
networkingMode=mirrored
wsl --shutdown
wsl
  1. Solution - Bridged
  • This should work for Windows 10 and 11 host machine, but I’m unable to test on Windows 10.
  • Create Hyper-V Virtual Switch. virtual-switch-name
  • .wslconfig set networkingMode=bridged and vmSwitch=YOURSWITCHNAME (Named mine Hyper-V)
[wsl2]
networkingMode=bridged
vmSwitch=YOURSWITCHNAME
wsl --shutdown
wsl