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

Can't ping failing in both directions after updating to 10.0.20197.0 #5805

Open
mwoodpatrick opened this issue Aug 25, 2020 · 34 comments
Open
Labels

Comments

@mwoodpatrick
Copy link

Environment

Windows build number: [Environment]:: Win32NT             10.0.20197.0 Microsoft Windows NT 10.0.20197.0
Your Distribution version: Release:        20.04
Whether the issue is on WSL 2 and/or WSL 1: WSL2

Steps to reproduce

In WSL2->Win dir

On WSL2:

cat /etc/resolv.conf (gave 172.31.0.1) then 'ping 'gave:

PING 172.31.0.1 (172.31.0.1) 56(84) bytes of data.
From 172.31.7.186 icmp_seq=1 Destination Host Unreachable
From 172.31.7.186 icmp_seq=2 Destination Host Unreachable

strace log attached and reported a number of issues

In Win->WSL2 dir
On WSL2 determine ip address using: "ip addr|grep eth0" on my system this gave 172.31.7.186
On PS7: ping <ip address determined in step 1>

I then get

ping 172.31.7.186
Pinging 172.31.7.186 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.

I verified that sshd was running

strace_wsl_ubuntu_20.04.log

WSL logs:

Expected behavior

ping should complete normally in both directions

Actual behavior

ping failed in both directions

@mwoodpatrick
Copy link
Author

I tried adding a new distribution Debian to see if it hit the same issues and it did. I also noticed that this distribution is missing strace & uuidgen is this expected?

@ec-max
Copy link

ec-max commented Aug 25, 2020

Check your windows defender firewall rules. Your probably getting icmp echo requests blocked due to default behavior on private networks.

@mwoodpatrick
Copy link
Author

mwoodpatrick commented Aug 25, 2020

I'm using Norton for my firewall and verified the settings I also disabled the firewall to see if it would help, it didn't. Also this was working and my Norton settings/software have not changed. The issue with ping failing when run from WSL2 appears to be the missing files reported in the strace log

@xquangdang
Copy link

I also have this problem. I've upgraded to latest insider build. If I restart, wsl2 can access to the internet and ping to host machine. but after awhile (30m-1h) the problem occurred, I can not access internet or ping to host machine, but I can still access wsl via localhost.

@KiruyaMomochi
Copy link

Same. And when I inspect Adapter Settings, I can not find any Hyper-V adapters.

@xiaoqidun
Copy link

The same problem, wsl network does not work when the system wakes up from sleep.

@dklawren
Copy link

Same problem happening consistently to me as well. Dell XPS 15 7590 running latest insider build, if laptop sleeps/hibernates, when it resumes WSL2 cannot access internet whatsoever. Rebooting machine completely (non-sleep) brings connectivity back properly.

@mwoodpatrick
Copy link
Author

mwoodpatrick commented Aug 26, 2020

Confirmed I am also seeing ping work right after boot (on Ubuntu 20.04 & 18.04) but then failing a little later (maybe 30 minutes or so) in my case system had not gone to sleep. I had recently connected to a VPN before the failure (not sure if these events are related).

@xquangdang
Copy link

Confirmed I am also seeing ping work right after boot (on Ubuntu 20.04 & 18.04) but then failing a little later (maybe 30 minutes or so) in my case system had not gone to sleep. I had recently connected to a VPN before the failure (not sure if these events are related).

I have Kerio VPN network. Yesterday I reset Windows and have everything reinstall but the problem still occurred

@mwoodpatrick
Copy link
Author

Immediately after reboot when I run Get-NetAdapter in powershell I get:

Name                      InterfaceDescription                    ifIndex Status       MacAddress             LinkSpeed
----                      --------------------                    ------- ------       ----------             ---------
Ethernet 3                Cisco AnyConnect Secure Mobility Clien…      29 Not Present  00-05-9A-3C-7A-00          0 bps
Ethernet 4                TAP-NordVPN Windows Adapter V9               27 Disconnected 00-FF-C5-12-E8-37         1 Gbps
vEthernet (Default Switc… Hyper-V Virtual Ethernet Adapter             34 Disconnected 00-15-5D-CB-09-98          0 bps
Wi-Fi 2                   Intel(R) Dual Band Wireless-AC 8265 #2       24 Up           20-16-B9-F4-5D-1C        36 Mbps
Ethernet 5                Symantec TAP Driver                          20 Disconnected 00-FF-8D-26-88-25         1 Gbps
NordLynx                  NordLynx Tunnel                              13 Disconnected                         100 Gbps
Bluetooth Network Con...2 Bluetooth Device (Personal Area Ne...#2       6 Disconnected 20-16-B9-F4-5D-20         3 Mbps
vEthernet (WSL)           Hyper-V Virtual Ethernet Adapter #2          68 Up           00-15-5D-73-33-BC        10 Gbps

After I start VPN (Cisco AnyConnect in my case) I get:

Name                      InterfaceDescription                    ifIndex Status       MacAddress             LinkSpeed
----                      --------------------                    ------- ------       ----------             ---------
Ethernet 3                Cisco AnyConnect Secure Mobility Clien…      29 Up           00-05-9A-3C-7A-00      99.5 Mbps
Ethernet 4                TAP-NordVPN Windows Adapter V9               27 Disconnected 00-FF-C5-12-E8-37         1 Gbps
vEthernet (Default Switc… Hyper-V Virtual Ethernet Adapter             34 Disconnected 00-15-5D-CB-09-98        10 Gbps
Wi-Fi 2                   Intel(R) Dual Band Wireless-AC 8265 #2       24 Up           20-16-B9-F4-5D-1C        54 Mbps
Ethernet 5                Symantec TAP Driver                          20 Disconnected 00-FF-8D-26-88-25         1 Gbps
NordLynx                  NordLynx Tunnel                              13 Disconnected                         100 Gbps
Ethernet 2                Plugable Ethernet                            12 Up           8C-AE-4C-F6-F6-95       100 Mbps
Bluetooth Network Con...2 Bluetooth Device (Personal Area Ne...#2       6 Disconnected 20-16-B9-F4-5D-20         3 Mbps
vEthernet (WSL)           Hyper-V Virtual Ethernet Adapter #2          68 Disconnected 00-15-5D-73-33-BC          0 bps

So in the first listing vEthernet (WSL) is shown as "Up" and in the second is shown as "Disconnected" anyone know if such events are logged somewhere?

@Hebilicious
Copy link

Hebilicious commented Aug 27, 2020

I'm having the same issue on 20197. I do not use a VPN, but I have docker desktop with the WSL2 backend.
Rebooting windows does not fix the issue for me, the Ethernet Adapter WSL shows as Media Disconnected immediately after a reboot.

A new build is available,
There isn't anything mentioned in the release notes, but I'm gonna try it and see if it fixes anything.

@vcjr
Copy link

vcjr commented Aug 28, 2020

I ended up uninstalling Docker and it seemed to help. But the problem persist simply by connecting and switching my active network connection WSL2 disconnects.

@KiruyaMomochi
Copy link

The problem still exists on Build 20201.

@dklawren
Copy link

I ended up uninstalling Docker and it seemed to help. But the problem persist simply by connecting and switching my active network connection WSL2 disconnects.

After playing trying out some other things, I seem to experience it more often now when I go from wireless to wired connections. At my desk I uses a docking station with ethernet and when I plug it in, WSL2 cannot access the network anymore unless I reboot.

@vcjr
Copy link

vcjr commented Aug 28, 2020 via email

@danvy
Copy link

danvy commented Sep 3, 2020

Same issue here on Windows 20206.
I don't switch from ethernet to wifi.
I have Docker installer but not running.
I tried to set /etc/wsl.conf to

[network]
generateResolvConf = false

and /etc/resolv.conf to

nameserver 8.8.8.8

without success.
Happen on fresh boot. Reboot might help.

@KiruyaMomochi
Copy link

  • Looks like it's a Hyper-V issue. Windows Sandbox and other Hyper-V VMs also cannot access the internet.
  • It happens every time my network environment changed. (Change from wired to wireless network in detail.)
  • It's still not fixed on Build 20206.

@sc0ttwad3
Copy link

I've found a disable/enable cycle on every Hyper-V Virtual Switch Extension Adapter in your network stack, restores network connectivity and DNS resolution to WSL 2. YMMV, but see my brief How-To.

@natronkeltner
Copy link

I am seeing this same behavior on 20211. After reboot, WSL2 and networking works fine. As soon as I start my OpenVPN client, WSL2 networking no longer works and WSL shows "Destination Host Unreachable" for all hosts. In addition to breaking WSL usage, it breaks vscode wsl integration and docker. I've had to uninstall docker in the interim.

Get-NetAdapter shows the WSL interface(s) in a Disconnected state.

The disable/enable cycling of the Hyper-V Virtual Switch Extension Adapters mentioned above does not work for me. Same behavior.

@mwoodpatrick
Copy link
Author

With 20211 I continue to see the same disconnected "Hyper-V Virtual Ethernet Adapter" state occurring. The reset sequence does fix the state of the switch and sometimes I am then able to get network traffic in my Linux distributions but sometimes I have to reboot. I am able to use Cisco AnyConnect VPN and my Linux distributions still have a working network,

@fsoikin
Copy link

fsoikin commented Sep 15, 2020

Disabling/enabling the Hyper-V virtual adapter doesn't work for me on build 20211. I have to reboot Windows every damn time. :-/

@cmeiklejohn
Copy link

Confirm, build 20211 has this problem and the Hyper-V enable/disable fix doesn't work for me either.

@sc0ttwad3
Copy link

Build 20215 and it still doesn't work. It has been three weeks (and 3 builds) for me, without DNS resolution. I've tried everything in my bag of tricks, and most of the work-arounds in this and four other threads with the same or similar issue. We need some kind of update on this, IMHO.

@andrp92
Copy link

andrp92 commented Sep 26, 2020

Still having same issue. Not fix at all :(

@sc0ttwad3
Copy link

With build 20221 networking in WSL 2 is still whacked. Looks like they are working on it:

@andrzejnovak - yes, we've identified a regression in the networking stack - expect the change in a forthcoming Insider Fast build.

@sc0ttwad3
Copy link

sc0ttwad3 commented Oct 1, 2020

Updated to Win 10 Insiders build 20226 and today's (10/1/20) edge channel release of Docker Desktop Community 2.4.1.0 with docker engine 19.03.13, build 4484c46d9d, early this morning, and WSL 2 network connectivity and DNS name resolution is finally working again. Since then, hibernation while I was at lunch, returned and WSL 2 remains working without any issues. 🤞

@mwoodpatrick
Copy link
Author

mwoodpatrick commented Oct 2, 2020

I'm still having problems I just installed 20226 and networking was fine until I enabled VPN and that killed it.

Some related discussion came to my notice today:

I recently saw this blog post from a VPN developer about WSL2 leaking network traffic when using a VPN, and it seems likely that it affects Cisco AnyConnect.

https://mullvad.net/en/blog/2020/9/30/linux-under-wsl2-can-be-leaking/

This seems pretty fundamental to WSL2, and since many are working from home over VPN, definitely beware. Some related issues in the WSL repository hint at this as well, so you may need to do some extra setup inside WSL2 for connecting to hosts.

#5068 WSL2 , problem with network connection when VPN used (PulseSecure) #5068

@sc0ttwad3
Copy link

This script was posted a couple days ago, and is the only thing that has worked to fix these issues for me. Anytime my WSL networking stops working, with the latest build, seems to only happen after VPN connection. Run this script, everything works again. I think the piece I was missing when I restarting LxssManager and the NetAdapters, was the Host Name Service (hns). YMMV

#5821 (comment)

@sergeivolodin

The posted workaround works for me and I have created a powershell script to run the three steps:

echo "Restarting WSL Service"
Restart-Service LxssManager
echo "Restarting Host Network Service"
Stop-Service -name "hns"
Start-Service -name "hns"
echo "Restarting Hyper-V adapters"
Get-NetAdapter -IncludeHidden | Where-Object `
    {$_.InterfaceDescription.StartsWith('Hyper-V Virtual Switch Extension Adapter')} `
    | Disable-NetAdapter -Confirm:$False
Get-NetAdapter -IncludeHidden | Where-Object `
    {$_.InterfaceDescription.StartsWith('Hyper-V Virtual Switch Extension Adapter')} `
    | Enable-NetAdapter -Confirm:$False

@pdumon
Copy link

pdumon commented Oct 17, 2020

This script was posted a couple days ago, and is the only thing that has worked to fix these issues for me. Anytime my WSL networking stops working, with the latest build, seems to only happen after VPN connection. Run this script, everything works again. I think the piece I was missing when I restarting LxssManager and the NetAdapters, was the Host Name Service (hns). YMMV

#5821 (comment)
@sergeivolodin
The posted workaround works for me and I have created a powershell script to run the three steps:

echo "Restarting WSL Service"
Restart-Service LxssManager
echo "Restarting Host Network Service"
Stop-Service -name "hns"
Start-Service -name "hns"
echo "Restarting Hyper-V adapters"
Get-NetAdapter -IncludeHidden | Where-Object `
    {$_.InterfaceDescription.StartsWith('Hyper-V Virtual Switch Extension Adapter')} `
    | Disable-NetAdapter -Confirm:$False
Get-NetAdapter -IncludeHidden | Where-Object `
    {$_.InterfaceDescription.StartsWith('Hyper-V Virtual Switch Extension Adapter')} `
    | Enable-NetAdapter -Confirm:$False

worked for me, tx a lot!

@samtaba
Copy link

samtaba commented Nov 3, 2020

This script was posted a couple days ago, and is the only thing that has worked to fix these issues for me. Anytime my WSL networking stops working, with the latest build, seems to only happen after VPN connection. Run this script, everything works again. I think the piece I was missing when I restarting LxssManager and the NetAdapters, was the Host Name Service (hns). YMMV

#5821 (comment)
@sergeivolodin
The posted workaround works for me and I have created a powershell script to run the three steps:

echo "Restarting WSL Service"
Restart-Service LxssManager
echo "Restarting Host Network Service"
Stop-Service -name "hns"
Start-Service -name "hns"
echo "Restarting Hyper-V adapters"
Get-NetAdapter -IncludeHidden | Where-Object `
    {$_.InterfaceDescription.StartsWith('Hyper-V Virtual Switch Extension Adapter')} `
    | Disable-NetAdapter -Confirm:$False
Get-NetAdapter -IncludeHidden | Where-Object `
    {$_.InterfaceDescription.StartsWith('Hyper-V Virtual Switch Extension Adapter')} `
    | Enable-NetAdapter -Confirm:$False

This worked for me, thanks.

@shazz
Copy link

shazz commented Nov 20, 2020

for me too! Thanks @sergeivolodin

@atorr0
Copy link

atorr0 commented Oct 29, 2021

Hi all,

I tried @sc0ttwad3 's Disable-NetAdapter + Enable-NetAdapter without any success, but I got a permanent ping by setting the advanced property "RSS Profile" to "Closest Processor", but YMMV:

image

Good luck!

Post-Edit: I have same success disabling the wifi and some seconds later re-enabling it.
Post-Edit2: I have set the VM with a static IP (172.25.60.31/20) and it seems working.

@bizsimon
Copy link

bizsimon commented Jan 4, 2022

This script was posted a couple days ago, and is the only thing that has worked to fix these issues for me. Anytime my WSL networking stops working, with the latest build, seems to only happen after VPN connection. Run this script, everything works again. I think the piece I was missing when I restarting LxssManager and the NetAdapters, was the Host Name Service (hns). YMMV

#5821 (comment)
@sergeivolodin
The posted workaround works for me and I have created a powershell script to run the three steps:

echo "Restarting WSL Service"
Restart-Service LxssManager
echo "Restarting Host Network Service"
Stop-Service -name "hns"
Start-Service -name "hns"
echo "Restarting Hyper-V adapters"
Get-NetAdapter -IncludeHidden | Where-Object `
    {$_.InterfaceDescription.StartsWith('Hyper-V Virtual Switch Extension Adapter')} `
    | Disable-NetAdapter -Confirm:$False
Get-NetAdapter -IncludeHidden | Where-Object `
    {$_.InterfaceDescription.StartsWith('Hyper-V Virtual Switch Extension Adapter')} `
    | Enable-NetAdapter -Confirm:$False

only solution so far that worked.
i guess looking into resolv.conf/wsl.conf/Get-NetIPInterface are all essential when WSL looses connections

@KonanTheLibrarian
Copy link

This bug hits Microsoft's Biggest Customers the Most

Coincidence: DELL seems to be a common denominator. This may be simply a result of larger corporations using VPNs
and obviously use DELL laptops through IT services.
WSL2 Network connectivity should not just fail after waking up from PC sleep. Briefly disconnecting WiFi or Ethernet breaks ONLY WSL2 nothing else. All the other applications work after wake up and work after reconnecting the network, NOT WSL2.

It's September 2023, this bug report was posted over 3 years ago and NOT FIXED. This bug ONLY affects WSL1 and WSL2 and hundreds of similar bug reports per year for 10+ years have been posted ALL WITH NO FIX. The people reading these reports also close them like it is not a bug, yet this bug is costing Microsoft BILLIONS as it affects ALL THE BIGGEST customers!
It has also got MUCH WORSE in 2023! Users applying "script" fixes find they still do not work either.
You just have to reboot over and over to get it working.

I notice that I also have to start WSL2:Debian first (which then has no network) then start WSL2:Ubuntu then both get network,
if you are lucky. Ping to test, and reboot if no ping.
Also only 1 in 6 reboots work and you can't take a lunch break or it breaks again and then you have to do 2 to 9 reboots or so!
FIREWALL? If it was the firewall then the rejection of the connections would be consistent not random.

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