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

WSL2 cannot connect to Internet occasionally [DNS ok, connectivity with host ok]; reset network has chance to fix this temporary #7984

Closed
1 of 2 tasks
huweiATgithub opened this issue Jan 28, 2022 · 7 comments

Comments

@huweiATgithub
Copy link

huweiATgithub commented Jan 28, 2022

Version

Microsoft Windows [Version 10.0.19044.1469]

WSL Version

  • WSL 2
  • WSL 1

Kernel Version

5.10.60.1

Distro Version

Ubuntu 20.04

Other Software

No response

Repro Steps

Don't know.

ping google.com

Expected Behavior

It should receive some responses.

Actual Behavior

-> ping google.com

PING google.com (142.251.40.174) 56(84) bytes of data.
^C
--- google.com ping statistics ---
136 packets transmitted, 0 received, 100% packet loss, time 140436ms

Diagnostic Logs

Connectivities issue:

  • The connectivity between host and wsl2 is ok; I can successfully ping the host from wsl2 and vice visa.
  • The wsl2 has no problem in resolving name; it resolves google to 142.251.40.174; I can ping this address in the host machine and through the host browser.

Chances to resolve:

  • Sometimes connecting to a VPN and then disconnecting can resolve this. (sometimes don't)
  • Network reset the host machine seems to always resolve this;

The connectivity to public addresses lose occasionally even after resolving it by the last two steps.

How to fix this? Or how to trace where does the packet lose?

@Yvand
Copy link
Member

Yvand commented Jan 31, 2022

I experience the exact same behaviour: DNS resolution works, ping of the host works, but all bash commands which need to connect to Internet hang and eventually fail.
For example, if I run git push I get this error after some time:

ssh: connect to host ssh.dev.azure.com port 22: Network is unreachable
fatal: Could not read from remote repository.

More details:

  • Docker containers are not affected and can connect to Internet normally.
  • It happens only (and always) when I connect my laptop to internet through my smartphone. I set it as a metered connection, but it does not help if I switch the metered connection setting to off.

@kamorrissey
Copy link

kamorrissey commented Feb 16, 2022

I have what sounds like a similar problem. Within a couple minutes of rebooting or logging out and logging in, I can ping google.com, but "curl google.com" times out. It does this with the firewall (McAfee) on or off. I am running Windows 11, "Ubuntu" MS Store image. Definitely set for WSL 2. Nothing special about network, just 5GHz wi-fi to a cable model/router. I have apt installed a lot of stuff, because I was trying to use WSL for development, so I have no idea what could be significant.

I have a Windows 10 desktop on the network with similar applications and packages installed. It does not have this WSL problem.

networking_bat.txt

I tried attaching a zip of wsl.etl, but it won't let me.

@huweiATgithub
Copy link
Author

From recent experience, now:

  • fresh start the windows: ping host ok, ping google.com can find IP but no response. [the IP is visitable in host]
  • connect to VPN then disconnect: network in wsl2 works smoothly. [VPN is ExpressVPN]

@huweiATgithub
Copy link
Author

I experience the exact same behaviour: DNS resolution works, ping of the host works, but all bash commands which need to connect to Internet hang and eventually fail. For example, if I run git push I get this error after some time:

ssh: connect to host ssh.dev.azure.com port 22: Network is unreachable
fatal: Could not read from remote repository.

More details:

  • Docker containers are not affected and can connect to Internet normally.
  • It happens only (and always) when I connect my laptop to internet through my smartphone. I set it as a metered connection, but it does not help if I switch the metered connection setting to off.

Maybe set cell phone network to private will work (if it has not been set so).

@Ikki-Dai
Copy link

Ikki-Dai commented Mar 8, 2022

I have similar issues,ping works fine, but curl doesn't work and docker containers are not affected
i tried use wireshark to catch the network,
DNS work fine, but not found docker pull network activity go through WSL

@voku
Copy link

voku commented Nov 10, 2023

I see the same problem, DNS is ok but I have no internet access e.g.
root@SUCKUP:/etc/apt# ping google.de PING google.de (142.250.185.99) 56(84) bytes of data. ^C --- google.de ping statistics --- 3 packets transmitted, 0 received, 100% packet loss, time 2095ms

Copy link
Contributor

This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.

Thank you!

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

5 participants