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

With WSL2's Mirror Network Mode, Services on the Windows Host are Inaccessible, but the Reverse is Possible #12399

Open
1 of 2 tasks
MosZhang7 opened this issue Dec 21, 2024 · 3 comments

Comments

@MosZhang7
Copy link

MosZhang7 commented Dec 21, 2024

Windows Version

Microsoft Windows [Version 10.0.22631.4602]

WSL Version

2.3.26.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

5.15.167.4-1

Distro Version

Debian 12

Other Software

No response

Repro Steps

  1. The content of .wslconfig is as follows, with other options set to default::
  • [wsl2]
  • networkingMode=mirrored
  1. On Windows host: Run command python -m http.server 8000 in a directory only containing an index.html file:
  2. in WSL2: run command wget 127.0.0.1:8000
  3. Result: Connecting to 127.0.0.1:8000...

I tested all available network modes in WSL2. I was able to access the host service using both NAT and virtioProxy, but mirror mode (using 127.0.0.1) did not work.

However, when I run the command python3 -m http.server 8100 in the WSL2 distro and then run wget 127.0.0.1:8100 in PowerShell, it works fine.

Interestingly, on another laptop with the same WSL2 and Windows version, the setup works as expected. I'm confident the issue lies with some misconfiguration, but despite trying various approaches, I haven't been able to resolve it.

Expected Behavior

in WSL2: run command wget 127.0.0.1:8000 it works fine.

Actual Behavior

Connecting to 127.0.0.1:8000...

Diagnostic Logs

_No responseWslLogs-2024-12-21_12-17-00.zip
WslNetworkingLogs-2024-12-21_12-18-20.zip
_

Copy link

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs

Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The script will output the path of the log file once done.

If this is a networking issue, please use collect-networking-logs.ps1, following the instructions here

Once completed please upload the output files to this Github issue.

Click here for more info on logging
If you choose to email these logs instead of attaching to the bug, please send them to [email protected] with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

View similar issues

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!

Open similar issues:

Closed similar issues:

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

Copy link

Diagnostic information
Issue was edited and new log file was found: https://github.com/user-attachments/files/18217159/WslLogs-2024-12-21_12-17-00.zip
Multiple log files found, using: https://github.com/user-attachments/files/18217159/WslLogs-2024-12-21_12-17-00.zip
.wslconfig found
Detected appx version: 2.3.26.0

@MosZhang7
Copy link
Author

I have looked at similar issues in this project and found a solution: enabling the WiFi hotspot on my laptop. I'm curious why this works.

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

No branches or pull requests

1 participant