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

No network communication between WSL2 and host / internet #11991

Open
1 of 2 tasks
adestis-mb opened this issue Sep 3, 2024 · 19 comments
Open
1 of 2 tasks

No network communication between WSL2 and host / internet #11991

adestis-mb opened this issue Sep 3, 2024 · 19 comments
Labels
emailed-logs Logs have been emailed network

Comments

@adestis-mb
Copy link

Windows Version

Windows 11, Version 23H2, OS Build 22631.4112)

WSL Version

2.2.4.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

5.15.153.1-2

Distro Version

any

Other Software

No response

Repro Steps

I freshly installed my System in June or July 2024 including WSL2.
Everything was fine and working.
After some time passed by and I have not used WSL2 and after a bunch of Windows Updates I tried to use WSL2 last week.
From an Ubuntu 22.04 distro I was unable to make any network communication.
So I rebooted my system because I saw s.th. similar on other Windows systems before.

But also after a fresh reboot no network communication BESIDE DNS resolution is possible.
I am also no able to ping the host anymore. This was working when I installed WSL2.

I already also tried the following things without success:

  • Uninstall WSL2 and Hyper-V completely
  • Reinstall WSL2 several times
  • Create a VM and place it inside "WSL (Hyper-V firewall)"
  • Try to capture traffic from distros and test-vm from interface "vEthernet (WSL (Hyper-V firewall))"
    (I was able to see ARP requests but no IP communication like ICMP pings)
  • Tried to disable Hyper-V firewall for "vEthernet (WSL (Hyper-V firewall))"

Expected Behavior

Network communication (ICMP, TCP, UDP) is possible from WSL2 to the host and to the Internet

Actual Behavior

Only ARP requests are arriving on the interface "vEthernet (WSL (Hyper-V firewall))" of the host.

Diagnostic Logs

No response

Copy link

github-actions bot commented Sep 3, 2024

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.

@adestis-mb
Copy link
Author

/emailed-logs

Copy link

github-actions bot commented Sep 3, 2024

Diagnostic information
Found '/emailed-logs', adding tag 'emailed-logs'

@github-actions github-actions bot added the emailed-logs Logs have been emailed label Sep 3, 2024
@adestis-mb
Copy link
Author

My problem is similar to #6831
But in my case I don't have any external anti-virus SW running.

The solution in #10774 does not work for me at all.

@adestis-mb
Copy link
Author

BTW: I forgot to mention that I have tested the mirror modus as well.
The result is the same, only ARP protocol is working but none of the IP protocols.

@CatalinFetoiu
Copy link
Collaborator

CatalinFetoiu commented Sep 3, 2024

thanks for reporting the issue - can you please collect networking logs using this script? https://github.com/microsoft/WSL/blob/master/diagnostics/collect-networking-logs.ps1

it will create a zip with name starting with "WslNetworkingLogs"

please feel free to email those logs as well

@adestis-mb
Copy link
Author

adestis-mb commented Sep 4, 2024

Log sent via email to [email protected]

@adestis-mb
Copy link
Author

Seems like your email servers are rejecting the created log file.
I will upload it to onedrive and share the link via email.

@adestis-mb
Copy link
Author

I also found out that there seems to be Hyper-V networking issues.
So the test VM cannot ping the host though the firewall rules allows it.

When I create a new hyper-V network (internal) DHCP seems not to work.

I am really frustrated because I have installed Windows 11 only a few weeks ago.

@zcobol
Copy link

zcobol commented Sep 5, 2024

@adestis-mb there's hnsdiag command and few pwsh cmdlets that help troubleshooting your setup. From an elevated prompt try running hdsdiag list networks. Also get-hnsendpoint to see the settings of your WSL interface.

hnsdiag reset all will reset your networks, namespaces, endpoints and loadbalancers. Use hnsdiag --help for more info.

Cmdlets from the HostNetworkingService module:

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Function        Get-HnsEndpoint                                    1.0        HostNetworkingService
Function        Get-HnsNamespace                                   1.0        HostNetworkingService
Function        Get-HnsNetwork                                     1.0        HostNetworkingService
Function        Get-HnsPolicyList                                  1.0        HostNetworkingService

@adestis-mb
Copy link
Author

Hi zcobol,

hnsdiag list networks does not list the WSL network:

> hnsdiag list networks
Network : F2FACF81-07FB-4F62-8C43-71ECE60D157A
    Name             : _TEST_PRIVATE
    Type             : Private
    Subnet Address   : 172.24.112.0/20
    Gateway          : 172.24.112.1

Network : 1DEC157D-4E96-4611-80B4-1330AC956C24
    Name             : _TEST_INTERNAL
    Type             : Internal
    Subnet Address   : 172.27.48.0/20
    Gateway          : 172.27.48.1

Network : C08CB7B8-9B3C-408E-8E30-5E16A3AEB444
    Name             : Default Switch
    Type             : ICS
    Subnet Address   : 172.19.96.0/20
    Gateway          : 172.19.96.1

While the Virtual Switch Manager shows the WSL network:
image

get-hnsendpoint does not show anything even s.th. is running within WSL2

Unfortunately, there is no difference when I execute the hnsdiag reset all.
The only thing which has changed is that the WSL network is now a private network where it was an internal network before (I think so).

Regards
Markus

@AlMar-Devel
Copy link

Had similar issues, after many attempts this has been my solution (Windows 10 host machine, Ubuntu WSL guest):

https://stephenreescarter.net/wsl2-network-issues-and-win-10-fast-start-up/

@tomeks666
Copy link

tomeks666 commented Oct 7, 2024

Same for me. This started on Sep 6th. I managed to clone some git repos in the WSL without any issue. But minutes later I needed to download something with apt and it showed all kinds of errors, which suggested some IP6 problem. I tried all kinds of fixes, workarounds, related to apt, then IP6, virtual switches, uninstalling WSL, reinstalling, downloading new distros, tweaking the firewall etc. In my case ICMP works, I can ping everything. But nothing TCP based seems to connect. Currently it is in "mirrored" network mode sharing IP with the host apparently.

@adestis-mb
Copy link
Author

I think that MS messed up Hyper-V because I can see similar issues there.
The only workaround for me was switching to WSL1.
Not a solution for everything but in my case it helps me continuing my work.

@wooksys
Copy link

wooksys commented Oct 17, 2024

I'm doing something similar.
If I choose mirrored, there is a problem that the IP address is connected to the host side.
I do what I read from somewhere, so the network works.

  1. run "services.msc"
  2. stop "host network service"
  3. run "host network service"

@adestis-mb
Copy link
Author

The restart of the HNS does not change anything for me.
Even the reboot of the system has no positive impact.
IMHO Microsoft has f***ed up Hyper-V with an update..

@wooksys
Copy link

wooksys commented Oct 18, 2024

Hello,
Here's a batch file I use in admin mode every time I boot.

wsl --shutdown
net stop hns
net start hns
pause

@serbanghita
Copy link

serbanghita commented Oct 19, 2024

WSL networking stopped working for me after the last update to Windows 11, version 24H2

Microsoft Windows [Version 10.0.26100.2033]
(c) Microsoft Corporation. All rights reserved.

C:\Users\serba>wsl -l
  NAME                   STATE           VERSION
* Ubuntu                 Running         2
  docker-desktop-data    Stopped         2
  docker-desktop         Stopped         2

C:\Users\serba>wsl -v
WSL version: 2.3.24.0
Kernel version: 5.15.153.1-2
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.26100.2033

@wooksys solution works for me, created a wsl-fix.bat file that I'm running as an Administrator.

@jtnord
Copy link

jtnord commented Nov 8, 2024

The above script works (mostly) for me. When it does work when I then start ubuntu I am greeted with the following WSL warning:

❯ bash
wsl: Failed to create network endpoint with address: '172.21.2.10', assigned new address: '172.28.4.141'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
emailed-logs Logs have been emailed network
Projects
None yet
Development

No branches or pull requests

8 participants