Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config networkingMode=mirrored doesn't apply to wsl2 #11228

Closed
1 of 2 tasks
ruienger opened this issue Feb 29, 2024 · 3 comments
Closed
1 of 2 tasks

config networkingMode=mirrored doesn't apply to wsl2 #11228

ruienger opened this issue Feb 29, 2024 · 3 comments
Labels

Comments

@ruienger
Copy link

Windows Version

Microsoft Windows [Version 10.0.22621.3155]

WSL Version

2.0.14.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

5.15.133.1-1

Distro Version

Ubuntu 22.04

Other Software

No response

Repro Steps

I got only 1 distro installed in my PC, here's the steps:

  • set up Windows's VPN
  • run wsl --shutdown in cmd.exe
  • run New-NetFirewallHyperVRule -Name MyWebServer -DisplayName “My Web Server” -Direction Inbound -VMCreatorId “{40E0AC32-46A5-438A-A0B2-2B479E8F2E90}” -Protocol TCP -LocalPorts 80 in cmd.exe, i copy this command from Doc
  • edit the %UserProfile%/.wslconfig
  • wait for 10 sec or reboot the PC
  • run wsl in cmd.exe

Here is the .wslconfig file:

# Settings apply across all Linux distros running on WSL 2
[wsl2]

# Limits VM memory to use no more than 4 GB, this can be set as whole numbers using GB or MB
memory=4GB 

# Sets the VM to use two virtual processors
processors=2

# Network settings
[experimental]

networkingMode=mirrored
# dnsTunneling=true
# firewall=true
# autoProxy=true

Expected Behavior

successfully set the wsl's networkingMode to mirrored and hopefully wsl can access the network using VPN.

Actual Behavior

I got a message from Ubuntu:

C:\Users\somebody>wsl
wsl: 检测到 localhost 代理配置,但未镜像到 WSL。NAT 模式下的 WSL 不支持 localhost 代理。
somebody@localhost:/mnt/c/Users/somebody$

Traslation:

C:\Users\somebody>wsl
wsl: localhost proxy configuration detected, but not mirrored to WSL. WSL in NAT mode does not support the localhost proxy.
somebody@localhost:/mnt/c/Users/somebody$

Diagnostic Logs

No response

Copy link

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@peterbro1
Copy link

the networkingMode=mirrored needs to be under [wsl2], not [experimental]

@ruienger
Copy link
Author

the networkingMode=mirrored needs to be under [wsl2], not [experimental]

Thank you for comment.

but the method dosen't reslove the problem directly.
in result, i solved this issue by accident.

Here is the final .wslconfig

# Settings apply across all Linux distros running on WSL 2
[wsl2]

# Limits VM memory to use no more than 4 GB, this can be set as whole numbers using GB or MB
memory=4GB 

# Sets the VM to use two virtual processors
processors=2

# Network settings
# [experimental]

networkingMode=mirrored
# dnsTunneling=true
# firewall=true
# autoProxy=true

i reboot after change the .wslconfig, seems like it doesn't apply to wsl2.
a few days later, i reset my network setting to factory mode then my issue has been sloved......

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants