microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.43k stars 823 forks source link

Networking mirrored, WSL2 and the host machine are unable to access each other's services bidirectionally. #11600

Open KingOfGitH opened 5 months ago

KingOfGitH commented 5 months ago

Windows Version

Microsoft Windows [版本 10.0.22631.3527]

WSL Version

2.2.4.0

Are you using WSL 1 or WSL 2?

Kernel Version

5.15.153.1-microsoft-standard-WSL2

Distro Version

Ubuntu 22.04

Other Software

NONE.

This network issue is not related to Docker. I am using python3 -m http.server 6000 to set up a simple service, and the Python version is 3.10.12.

Repro Steps

Set .wslconfig:

[experimental]
sparseVhd=true
autoMemoryReclaim=gradual
networkingMode=mirrored
dnsTunneling=true
useWindowsDnsCache=true
hostAddressLoopback=true

Turn off the WSL2 firewall.

ufw disable
systemctl stop ufw

Turn off the Hyper-V firewall.

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

Open port 6000 on the Windows Firewall.

I even tried turning off the entire firewall and restarting the computer.

Run

python3 -m http.server 6000
curl localhost:6000
curl 127.0.0.1:6000
curl 10.0.0.140:6000
/mnt/c/Windows/System32/curl.exe localhost:6000
/mnt/c/Windows/System32/curl.exe 127.0.0.1:6000
/mnt/c/Windows/System32/curl.exe 10.0.0.140:6000

A service is running on the same host machine with port 47990, and WSL2 tries to access this service.

Expected Behavior

curl localhost:6000 #success
curl 127.0.0.1:6000 #success
curl 10.0.0.140:6000 #success
/mnt/c/Windows/System32/curl.exe localhost:6000 #success
/mnt/c/Windows/System32/curl.exe 127.0.0.1:6000 #success
/mnt/c/Windows/System32/curl.exe 10.0.0.140:6000 #success
curl localhost:47990 #success
curl 127.0.0.1:47990 #success
curl 10.0.0.140:47990 #success
/mnt/c/Windows/System32/curl.exe localhost:47990 #success
/mnt/c/Windows/System32/curl.exe 127.0.0.1:47990 #success
/mnt/c/Windows/System32/curl.exe 10.0.0.140:47990 #success

Actual Behavior

curl localhost:6000 #success
curl 127.0.0.1:6000 #success
curl 10.0.0.140:6000 #success
/mnt/c/Windows/System32/curl.exe localhost:6000 #Failed after 21046 ms: Couldn't connect to server
/mnt/c/Windows/System32/curl.exe 127.0.0.1:6000 #Failed after 21046 ms: Couldn't connect to server
/mnt/c/Windows/System32/curl.exe 10.0.0.140:6000 #Failed after 21046 ms: Couldn't connect to server
curl localhost:47990 #Failed after 134050 ms: Couldn't connect to server
curl 127.0.0.1:47990 #Failed after 134050 ms: Couldn't connect to server
curl 10.0.0.140:47990 #Failed after 134050 ms: Couldn't connect to server
/mnt/c/Windows/System32/curl.exe localhost:47990 #success
/mnt/c/Windows/System32/curl.exe 127.0.0.1:47990 #success
/mnt/c/Windows/System32/curl.exe 10.0.0.140:47990 #success

Diagnostic Logs

To be honest, I can't even determine the IP or other handles of Win11 and WSL2, which renders my network troubleshooting experience useless. I will try to troubleshoot further and send an email later.

github-actions[bot] commented 5 months ago

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](https://github.com/Microsoft/WSL/blob/master/diagnostics/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 scipt will output the path of the log file once done. Once completed please upload the output files to this Github issue. [Click here for more info on logging](https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#8-collect-wsl-logs-recommended-method) If you choose to email these logs instead of attaching to the bug, please send them to wsl-gh-logs@microsoft.com 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.

KingOfGitH commented 5 months ago

Here are the collected logs

Here are the collected logs. I have reviewed the above-mentioned issues, and they do not match my problem. Additionally, I just tested on another computer on the LAN, and it can access both 10.0.0.140:6000 and 10.0.0.140:47990 simultaneously.

github-actions[bot] commented 5 months ago

The log file doesn't contain any WSL traces. Please make sure that you reproduced the issue while the log collection was running.

Diagnostic information ``` .wslconfig found Detected appx version: 2.2.4.0 Found no WSL traces in the logs ```
KingOfGitH commented 5 months ago

Sorry, this is new logs WslLogs-2024-05-19_11-27-42.zip

github-actions[bot] commented 5 months ago
Diagnostic information ``` .wslconfig found Detected appx version: 2.2.4.0 ```
KingOfGitH commented 5 months ago

I changed the network mode to NAT, but it failed to start with the error Error code: Wsl/Service/CreateInstance/CreateVm/ConfigureNetworking/HNS/ERROR_UNHANDLED_EXCEPTION.

When I switched the network mode back to mirrored, something even stranger happened: computers on the LAN can no longer access port 6000 either.

Additionally, the ifconfig command fails to retrieve the host machine's IP 10.0.0.140.

WslLogs-2024-05-19_18-43-38.zip

# ifconfig

br-9154cb03c575: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.18.0.1  netmask 255.255.0.0  broadcast 172.18.255.255
        ether 02:42:03:3c:9f:34  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2  bytes 180 (180.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        ether 02:42:a2:1c:04:f5  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2  bytes 180 (180.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 12  bytes 1580 (1.5 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 12  bytes 1580 (1.5 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

veth421c985: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether ce:9d:61:e0:0b:48  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2  bytes 180 (180.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

vethaa81b74: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether ee:05:7d:59:f8:eb  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2  bytes 180 (180.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

# echo "LOOPBACK:      " $(ip r list table 127)

Error: ipv4: FIB table does not exist.
Dump terminated
LOOPBACK:
github-actions[bot] commented 5 months ago

An HNS error seems to be causing WSL2 to fail to start. Adding network tag

Diagnostic information ``` .wslconfig found Detected appx version: 2.2.4.0 Detected user visible error: Wsl/Service/CreateInstance/CreateVm/ConfigureNetworking/HNS/ERROR_UNHANDLED_EXCEPTION Found HNS error: Wsl/Service/CreateInstance/CreateVm/ConfigureNetworking/HNS/ERROR_UNHANDLED_EXCEPTION ```
github-actions[bot] commented 5 months ago

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](https://github.com/Microsoft/WSL/blob/master/diagnostics/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 scipt will output the path of the log file once done. Once completed please upload the output files to this Github issue. [Click here for more info on logging](https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#8-collect-wsl-logs-recommended-method) If you choose to email these logs instead of attaching to the bug, please send them to wsl-gh-logs@microsoft.com 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.

KingOfGitH commented 5 months ago

/question

github-actions[bot] commented 5 months ago
Diagnostic information ``` Found '/question', adding tag 'question' ```
github-actions[bot] commented 5 months ago

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](https://github.com/Microsoft/WSL/blob/master/diagnostics/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 scipt will output the path of the log file once done. Once completed please upload the output files to this Github issue. [Click here for more info on logging](https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#8-collect-wsl-logs-recommended-method) If you choose to email these logs instead of attaching to the bug, please send them to wsl-gh-logs@microsoft.com 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.

KingOfGitH commented 5 months ago

I changed the network mode to NAT, but it failed to start with the error Error code: Wsl/Service/CreateInstance/CreateVm/ConfigureNetworking/HNS/ERROR_UNHANDLED_EXCEPTION.

When I switched the network mode back to mirrored, something even stranger happened: computers on the LAN can no longer access port 6000 either.

Additionally, the ifconfig command fails to retrieve the host machine's IP 10.0.0.140.

WslLogs-2024-05-19_18-43-38.zip

# ifconfig

br-9154cb03c575: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.18.0.1  netmask 255.255.0.0  broadcast 172.18.255.255
        ether 02:42:03:3c:9f:34  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2  bytes 180 (180.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        ether 02:42:a2:1c:04:f5  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2  bytes 180 (180.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 12  bytes 1580 (1.5 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 12  bytes 1580 (1.5 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

veth421c985: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether ce:9d:61:e0:0b:48  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2  bytes 180 (180.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

vethaa81b74: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether ee:05:7d:59:f8:eb  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2  bytes 180 (180.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

# echo "LOOPBACK:      " $(ip r list table 127)

Error: ipv4: FIB table does not exist.
Dump terminated
LOOPBACK:

if fix this by https://github.com/microsoft/WSL/issues/11389

github-actions[bot] commented 5 months ago

An HNS error seems to be causing WSL2 to fail to start. Adding network tag

Diagnostic information ``` .wslconfig found Detected appx version: 2.2.4.0 Detected user visible error: Wsl/Service/CreateInstance/CreateVm/ConfigureNetworking/HNS/ERROR_UNHANDLED_EXCEPTION Found HNS error: Wsl/Service/CreateInstance/CreateVm/ConfigureNetworking/HNS/ERROR_UNHANDLED_EXCEPTION ```
chanpreetdhanjal commented 4 months ago

Hi. Can you please collect networking logs by following the instructions below? https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#collect-wsl-logs-for-networking-issues

KingOfGitH commented 4 months ago

Hi. Can you please collect networking logs by following the instructions below? https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#collect-wsl-logs-for-networking-issues

of course, this is logs WslLogs-2024-06-15_15-30-30.zip

I investigated and found a temporary solution. After turning on the system's mobile hotspot on Windows, there was no problem with the communication between WSL and the host, and I repeated this solution at the end of collecting the logs.

But I don't know the specific reason, I hope I can give you some clues

github-actions[bot] commented 4 months ago
Diagnostic information ``` .wslconfig found Failed to parse .wslconfig: doesn't support inline comment# Settings apply across all Linux distros running on WSL 2 # 推荐的一些配置项如下 [wsl2] # 核心配置 # debugConsole =true # autoProxy=false # 是否强制 WSL2/WSLg 子系统使用 Windows 代理设置(请根据实际需要启用) # dnsTunneling=true # WSL2/WSLg DNS 代理隧道,以便由 Windows 代理转发 DNS 请求(请根据实际需要启用) firewall=false # WSL2/WSLg 子系统的 Windows 防火墙集成,以便 Hyper-V 或者 WPF 能过滤子系统流量(请根据实际需要启用) # guiApplications=true # 启用 WSLg GUI 图形化程序支持 # ipv6=true # 启用 IPv6 网络支持 # localhostForwarding=true # 启用 localhost 网络转发支持 # memory=4GB # 限制 WSL2/WSLg 子系统的最大内存占用 # nestedVirtualization=true # 启用 WSL2/WSLg 子系统嵌套虚拟化功能支持 networkingMode=mirrored # 启用镜像网络特性支持 #pageReporting=true # 启用 WSL2/WSLg 子系统页面文件通报,以便 Windows 回收已分配但未使用的内存 # processors=8 # 设置 WSL2/WSLg 子系统的逻辑 CPU 核心数为 8(最大肯定没法超过硬件的物理逻辑核心数) # vmIdleTimeout=-1 # WSL2 VM 空闲超时关闭实现,-1 为永不关闭,根据参数说明,目前似乎仅适用于 Win11+ [experimental] # 实验性功能 autoMemoryReclaim=gradual # 启用空闲内存自动缓慢回收,其它选项:dropcache / disabled(立即/禁用) hostAddressLoopback=true # 启用 WSL2/WSLg 子系统和 Windows 宿主之间的本地回环互通支持 sparseVhd=true # 启用 WSL2/WSLg 子系统虚拟硬盘空间自动回收 # useWindowsDnsCache=false # 和 dnsTunneling 配合使用,决定是否使用 Windows DNS 缓存池 Detected appx version: 2.1.5.0 ```
mwwhited commented 4 months ago

this may have somthing to do with switching the primary network stack around. the issue started for me when I had to disconnect my cabled eithernet and switch to wifi/hotspot when my interenet was down. When the internet came back up and I changed the network back to wired eithernet I was no longer able to connect from windows to any wsl instance. The really weird part is WSL can still get to the internet, other WSL instances and external systems can still connect to WSL.

networkmode=mirrored local Windows to local Windows: works Remote to local windows: works remote to wsl: works wsl to wsl: works wsl to windows: does not work windows to wsl does not work wsl to remote: works windows to remote: works

both ufw and windows firewall were down.

If I switch WSL to NAT I can get from windows to wsl but remote system can no longer connect to wsl. and wsl can not connect to WSL.

KingOfGitH commented 4 months ago

this may have somthing to do with switching the primary network stack around. the issue started for me when I had to disconnect my cabled eithernet and switch to wifi/hotspot when my interenet was down. When the internet came back up and I changed the network back to wired eithernet I was no longer able to connect from windows to any wsl instance. The really weird part is WSL can still get to the internet, other WSL instances and external systems can still connect to WSL.

networkmode=mirrored local Windows to local Windows: works Remote to local windows: works remote to wsl: works wsl to wsl: works wsl to windows: does not work windows to wsl does not work wsl to remote: works windows to remote: works

both ufw and windows firewall were down.

If I switch WSL to NAT I can get from windows to wsl but remote system can no longer connect to wsl. and wsl can not connect to WSL.

I had the same problem, and the workaround I found was to turn on the hotspot on my computer in mirror mode, and everything worked fine. you can try it

mwwhited commented 4 months ago

I found I was able to "fix it" with npcap from wireshark. I'm guessing there is something screwed up in the bowels of the tcp/ip stack for local loop back ... for now I built myself a tool I can leave in the system tray and can activate when I need wsl/docker to work locally (I could also switch from mirrored to nat... but then I can't access it remotely.)

It would be nice to get an actual fix but yet another workaround is as good as anything else I guess (I've tried several of the other workarounds but they didn't work for me.)

https://github.com/microsoft/WSL/issues/10494#issuecomment-2184173520

Adam-Jin commented 3 months ago

I encountered the same problem, turning on the mobile hotspot or using wireshark to capture the local loopback port can work emm...

CatalinFetoiu commented 2 months ago

@KingOfGitH thanks for attaching logs, sorry for the delay following up on this

could you please collect WslNetworkingLogs, using https://github.com/microsoft/WSL/blob/master/diagnostics/collect-networking-logs.ps1 ?

please refer to the instructions at https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#collect-wsl-logs-for-networking-issues

KingOfGitH commented 2 months ago

@KingOfGitH thanks for attaching logs, sorry for the delay following up on this感谢您附上日志,抱歉延迟跟进此问题

could you please collect WslNetworkingLogs, using https://github.com/microsoft/WSL/blob/master/diagnostics/collect-networking-logs.ps1 ?您可以使用https://github.com/microsoft/WSL/blob/master/diagnostics/collect-networking-logs.ps1收集 WslNetworkingLogs 吗?

please refer to the instructions at https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#collect-wsl-logs-for-networking-issues请参阅https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#collect-wsl-logs-for-networking-issues上的说明

I have collected the logs, but unfortunately, there doesn't seem to be any useful content. The only thing I can do is use curl on WSL to access the following existing services on Windows and wait for a timeout. Then, I repeated the operation after turning on the mobile hotspot, proving that access is possible.

WslLogs-2024-06-15_15-30-30.zip

github-actions[bot] commented 2 months ago
Diagnostic information ``` .wslconfig found Failed to parse .wslconfig: doesn't support inline comment# Settings apply across all Linux distros running on WSL 2 # 推荐的一些配置项如下 [wsl2] # 核心配置 # debugConsole =true # autoProxy=false # 是否强制 WSL2/WSLg 子系统使用 Windows 代理设置(请根据实际需要启用) # dnsTunneling=true # WSL2/WSLg DNS 代理隧道,以便由 Windows 代理转发 DNS 请求(请根据实际需要启用) firewall=false # WSL2/WSLg 子系统的 Windows 防火墙集成,以便 Hyper-V 或者 WPF 能过滤子系统流量(请根据实际需要启用) # guiApplications=true # 启用 WSLg GUI 图形化程序支持 # ipv6=true # 启用 IPv6 网络支持 # localhostForwarding=true # 启用 localhost 网络转发支持 # memory=4GB # 限制 WSL2/WSLg 子系统的最大内存占用 # nestedVirtualization=true # 启用 WSL2/WSLg 子系统嵌套虚拟化功能支持 networkingMode=mirrored # 启用镜像网络特性支持 #pageReporting=true # 启用 WSL2/WSLg 子系统页面文件通报,以便 Windows 回收已分配但未使用的内存 # processors=8 # 设置 WSL2/WSLg 子系统的逻辑 CPU 核心数为 8(最大肯定没法超过硬件的物理逻辑核心数) # vmIdleTimeout=-1 # WSL2 VM 空闲超时关闭实现,-1 为永不关闭,根据参数说明,目前似乎仅适用于 Win11+ [experimental] # 实验性功能 autoMemoryReclaim=gradual # 启用空闲内存自动缓慢回收,其它选项:dropcache / disabled(立即/禁用) hostAddressLoopback=true # 启用 WSL2/WSLg 子系统和 Windows 宿主之间的本地回环互通支持 sparseVhd=true # 启用 WSL2/WSLg 子系统虚拟硬盘空间自动回收 # useWindowsDnsCache=false # 和 dnsTunneling 配合使用,决定是否使用 Windows DNS 缓存池 Detected appx version: 2.1.5.0 ```
CatalinFetoiu commented 2 months ago

@KingOfGitH thanks for following up. It looks like you collected logs using https://github.com/microsoft/WSL/blob/master/diagnostics/collect-wsl-logs.ps1

instead we need logs using https://github.com/microsoft/WSL/blob/master/diagnostics/collect-networking-logs.ps1

could you please collect logs using the second script?

thanks

KingOfGitH commented 2 months ago

@KingOfGitH thanks for following up. It looks like you collected logs using https://github.com/microsoft/WSL/blob/master/diagnostics/collect-wsl-logs.ps1

instead we need logs using https://github.com/microsoft/WSL/blob/master/diagnostics/collect-networking-logs.ps1

could you please collect logs using the second script?

thanks

No problem! Here’s the translation:


I apologize for previously missing this part of the log collection.

The collected logs are quite large,. I initially planned to send the logs as an email attachment. However, during the process, the file was uploaded to OneDrive and couldn't be converted into an attachment. Please check if you can access the logs using this link. If not, I will consider how to convert the link into an attachment. Thank you.

https://1drv.ms/u/c/cbedb7e1d4315f17/EYBGk57fS4pFgq01gX4fQ20B3UagrzgBYv-zsewSj8-c8A

The main operations were as follows:

First, I used the Windows curl command to access the service, and the result was successful access.

Then, I used the WSL curl command to access the service, but the result was a timeout.

Finally, after turning on the mobile hotspot, I used the WSL curl command to access the service, and this time the access was successful.

Clark-G commented 4 days ago

this may have somthing to do with switching the primary network stack around. the issue started for me when I had to disconnect my cabled eithernet and switch to wifi/hotspot when my interenet was down. When the internet came back up and I changed the network back to wired eithernet I was no longer able to connect from windows to any wsl instance. The really weird part is WSL can still get to the internet, other WSL instances and external systems can still connect to WSL. networkmode=mirrored local Windows to local Windows: works Remote to local windows: works remote to wsl: works wsl to wsl: works wsl to windows: does not work windows to wsl does not work wsl to remote: works windows to remote: works both ufw and windows firewall were down. If I switch WSL to NAT I can get from windows to wsl but remote system can no longer connect to wsl. and wsl can not connect to WSL.

I had the same problem, and the workaround I found was to turn on the hotspot on my computer in mirror mode, and everything worked fine. you can try it

I have the exact same issue. The workaround of turning on the hotspot works for me, but I am curious why is this happening?