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

WSL mirrored networking + VS Code WSL extension #11184

Open
bamurtaugh opened this issue Feb 20, 2024 · 10 comments
Open

WSL mirrored networking + VS Code WSL extension #11184

bamurtaugh opened this issue Feb 20, 2024 · 10 comments
Assignees
Labels

Comments

@bamurtaugh
Copy link
Member

As discussed on GitHub and offline, creating an issue to track VS Code user feedback that users are experiencing issues with WSL mirrored networking.

Here's the issue: microsoft/vscode-remote-release#9222. Here is an example of traces/logs: microsoft/vscode-remote-release#9222 (comment).

cc @craigloewen-msft

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.

@diagonjope
Copy link

WslLogs-2024-07-16_13-02-22.zip

@aeschli the wsl netwroking log file is 126 MB. Github has a max allowance of 25 MB. Where should I drop the log

@aeschli
Copy link

aeschli commented Jul 16, 2024

@keith-horton
Copy link
Member

Can you please share your VSCode configuration / docker configuration / docker-desktop configuration?

We have tested with a few VSCode configurations and haven't repro'd issues.

If the log is too large, can you share through onedrive / google drive?

It's not clear why the trace would be that huge though :)

I would recommend:

  • start the trace
  • wsl --shutdown
  • launch VS
  • repro the problem
  • stop the trace

@diagonjope
Copy link

Greetings @keith-horton !

Here you go:

WslNetworkingLogs-networkingMode_mirrored_disabled_2024-07-18_16-00-23.zip

WslNetworkingLogs-networkingMode_mirrored_enabled_2024-07-18_15-58-08.zip

Docker_settings.json

VSCode_settings.json

Let me know if you need anything else from me.

Cheers,

++José

@CatalinFetoiu
Copy link
Collaborator

thanks for sending the logs

unfortunately the tcpdump packet capture was not collected (the tcpdump.log file in the zip is empty)

could you please check if you have tcpdump installed in your linux distribution. if not, can you please install tcpdump and collect the logs again?

in the stackoverflow link, you shared VSCode terminal output and renderer.log file in the VSCode logs - can you please share those again for the latest repro? they showed some network connections timing out, that information will be helpful to narrow down the logs

thanks

@diagonjope
Copy link

diagonjope commented Jul 19, 2024

@netux
Copy link

netux commented Sep 21, 2024

Just chipping in for people looking as to why VSCode fails to connect when WSL is configured with networkingMode=mirrored.
I was looking at the docs in Microsoft's website[^1] and noticed there is a note about running some commands to allow the firewall to accept inbound connections from WSL:

Run the following command in PowerShell window with admin privileges to Configure Hyper-V firewall settings to allow inbound connections: Set-NetFirewallHyperVVMSetting -Name '{40E0AC32-46A5-438A-A0B2-2B479E8F2E90}' -DefaultInboundAction Allow or New-NetFirewallHyperVRule -Name "MyWebServer" -DisplayName "My Web Server" -Direction Inbound -VMCreatorId '{40E0AC32-46A5-438A-A0B2-2B479E8F2E90}' -Protocol TCP -LocalPorts 80.

The documentation doesn't go into detail as to what exactly Set-NetFirewallHyperVVMSetting/New-NetFirewallHyperVRule do, but my guess is the first command disables the firewall for any connections coming from WSL, while the second one does the same but only for TCP connections on port 80.

I ran the first command and, after restarting the WSL distro, VSCode was able to connect to it again 🙂

[1]: https://learn.microsoft.com/en-us/windows/wsl/networking#mirrored-mode-networking

@keith-horton
Copy link
Member

Hi there.

Yep, your understanding is very close.

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

This sets the default to Allow any inbound connection -- but if there are Block rules for inbound connections, those will still apply.

@FvTao
Copy link

FvTao commented Nov 25, 2024

The environment is as follows:

Version: Windows 11 Professional
Build: 23H2
Installation Date: November 6, 2024
Operating System Version: 22631.4317
Experience: Windows Feature Experience Pack 1000.22700.1041.0

PS C:\Users\root> wsl -v
WSL Version: 2.3.26.0
Kernel Version: 5.15.167.4-1
WSLg Version: 1.0.65
MSRDC Version: 1.2.5620
Direct3D Version: 1.611.1-81528511
DXCore Version: 10.0.26100.1-240331-1435.ge-release
Windows Version: 10.0.22631.4317

PS C:\Users\root> wsl -l -v
  NAME            STATE           VERSION
* Ubuntu-22.04    Stopped         2



[wsl2]
memory = 24GB
networkingMode=mirrored
dnsTunneling=true
firewall=true
autoProxy=true
[experimental]
hostAddressLoopback=true

I have already executed Set-NetFirewallHyperVVMSetting -Name '{40E0AC32-46A5-438A-A0B2-2B479E8F2E90}' -DefaultInboundAction Allow.

Cannot connect to WSL with mirrored networking.

When configuring networkingMode=mirrored, Visual Studio Code keeps showing "Connecting..."

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

8 participants