Contents

Solving VPN Network Access Issues in WSL2 Ubuntu on Windows 11

Contents

I recently had to dive into the Windows 11 world with a fancy laptop and run WSL2 (Ubuntu). All was good until I hit a wall – no network access when my AnyConnect VPN kicked in (Windows Host). And it wasn’t just a run-of-the-mill DNS problem; I couldn’t even reach my router!

Googling around I found a bunch of posts about similar issues, but most were about DNS. I tried tweaking interface metrics priorities through scripts, and sometimes it worked, sometimes not – definitely not ideal to run a script every time I connect to the VPN.

during my investigation I noticed a new networking mode “mirrored-mode-networking”, I enabled this new mode, worked and problem solved up to now.

What I did, Created a new file in location : C:\Users\<UserName>\.wslconfig with the following contents:

1
2
3
# Settings apply across all Linux distros running on WSL 2
[wsl2]
networkingMode=mirrored

Tested with Windows 11 Pro, v10.0.22631, WSL version: 2.0.9.0