Closed awson closed 7 months ago
@johanhammar
The powershell solution looks cool but unfortunately running scripts on my system is disabled. Any other workarounds available, except rebooting?
You probably don't have administrative rights, which means none of the workaround will work for you. Adding routes and restarting services both need admin-rights.
@johanhammar
The powershell solution looks cool but unfortunately running scripts on my system is disabled. Any other workarounds available, except rebooting?
You probably don't have administrative rights, which means none of the workaround will work for you. Adding routes and restarting services both need admin-rights.
It's a policy that prevents scripts from being executed. So the workaround won't work for us.
@johanhammar
The powershell solution looks cool but unfortunately running scripts on my system is disabled. Any other workarounds available, except rebooting?
You probably don't have administrative rights, which means none of the workaround will work for you. Adding routes and restarting services both need admin-rights.
It's a policy that prevents scripts from being executed. So the workaround won't work for us.
In that case you could run the commands in a PowerShell-prompt, except for the first line (the one starting with if
). You'd have to start an elevated prompt manually, though. If your company does allow signed scripts, you could see if you can make a signed version of the script, but that is beyond the scope of this issue. Google will be your friend for that, or your own support staff.
It was firewall for me. My VPN allowed WSL1, but not WSL2.
I'm having this issue as well. I converted a working WSL v1 instance into a WSL v2 instance. Now I have no networking. Bringing eth0 up
has no effect, nor does changing the Hyper-V switch from internal or private to external.
Ubuntu 20.04 running on Windows 10 Version 21H1.
I have a potentially interesting finding. On my end, it appears that after failing to resolve a host (I can confirm that the host doesn't work both on the WSL instance and on Windows itself, but the others do), it will fail to resolve anything else. In my case, this happened when I was trying to build neovim, which downloads libraries from the internet. When www.leonerd.org.uk
fails to work (this also fails on WIndows: https://github.com/neovim/neovim/issues/14764), the following lookups for github.com all fail, while github.com works on Windows. If I log into WSL and ping github.com, then ping the failing URL, then try to ping github.com again, it will not work.
Edit: the last sentence does not hold true if I change to another DNS server in /etc/resolv.conf. This is some very interesting behavior.
@willeccles there is a bunch of related issues on DNS resolution in WSL(2), some of which are indeed contaminated by different network issues - anyway, I believe this issue here is about network connectively overall, including being able to access a DNS server in the first place. So maybe your comment would be best placed in other issues.
Ubuntu 18.04 and 20.04 (i.e. all WSL distributions) do not have any network connectivity (not even localhost). It seems the network interface for WSL is gone. Host network is working fine.
OS Name Microsoft Windows 10 Pro Version 10.0.19043 Build 19043
Virtualization-based security Running
Virtualization-based security Required Security Properties
Virtualization-based security Available Security Properties Base Virtualization Support
Virtualization-based security Services Configured
Virtualization-based security Services Running
A hypervisor has been detected. Features required for Hyper-V will not be displayed.
No connectivity from wsl2 to the internet after Windows update KB5003537 was applied automatically last night. I uninstalled the update and everything working fine again.
@janfrederik if you're seeing this from the latest update could you please collect networking logs and post them to this Github issue: https://github.com/microsoft/WSL/issues/7141
Instructions here: https://github.com/microsoft/WSL/issues/7141#issuecomment-874917153
sc stop cmservice
sc stop hns
sc stop vmcompute
sc stop lxssmanager
Do I have to write that cmd, powershell or wsl?
P.S. Oh right I tried it in powershell and it worked. Thanks.
@janfrederik if you're seeing this from the latest update could you please collect networking logs and post them to this Github issue: #7141
@craigloewen-msft Yesterday I installed the "2021-07 Cumulative Update for Windows 10 Version 20H2 for x64-based Systems (KB5004945)" and had no problems afterwards. So it seemed to be specific to KB5003537 (which is part of KB5004945 because Windows Update does not suggest it anymore?).
@dezza I resolved my issue in the context of your answer:
Container Management Service needed to be shutdown first. This is working for a re-jolt of the networking in WSL2 from suspend mode.
# sc stop cmservice # sc stop hns # sc stop vmcompute # sc stop lxssmanager
Then start them back up again.
Depression has ended. šššš„°
Thank you very much, this worked perfectly on my end!
I didn't need to restart the cmservice though. I actually don't even have it in my copy of Windows.
Just stopping hns
, vmcompute
, lxssmanager
and then starting them again using sc start
worked wonderfully!
WSL2 has network, startup and installation issues - solution:
Disable encryption and file compression:
for %TEMP%
- the swap file there by default location
Or specify where to save in %USERPROFILE%\.wslconfig
and disable there:
[wsl2]
...
swapFile = E:\\Temp\\swap.vhdx
...
Disable encryption and compression on directories with distributions:
%appdatalocal%\Packages\CanonicalGroupLimited.Ubuntu*
%appdatalocal%\Packages\TheDebianProject.DebianGNULinux*
https://gist.github.com/mandeepsmagh/f1d062fc59e4e6115385c2609b5f0448
This works like a charm. Just had to set the servername according to the wifi gateway
check this solution. It worked for me after trying all the above suggestions. Answer here.
Just leaving another potential solution when all solutions telling you to change resolv.conf
and adding nameservers do not work.
I have been trying to fix internet not working when behind corporate VPN for a long time without any success. After seeing some answers over the internet suggesting to use wsl-vpnkit
I confirm that following the approach in https://github.com/sakai135/wsl-vpnkit I finally managed basically effortlessly to have internet connectivity in wsl2 even when over corporate VPN
Edit: I just verified that I actually need both solutions for the system to work. I need to have the correct nameservers (the ones from my corporate network to have connectivity when behind VPN, and also some generic ones like google's dns as fallback for having it work outside of the VPN) on resolv.conf
but I also need to enable the wsl-vpnkit
as above otherwise I still can't connect to the internet.
Experiencing the same issue on Windows 11 build 22000.978 (edit: still happening on 22621.1413). I have isloated the problem and found a (bad) workaround. The issue is that the Hyper-V Default Switch used for WSL2 NAT networking selects/uses the wrong uplink interface, consistently.
In addition to a few different VPN interfaces (not relevant), I primarily use the on-board Ethernet interface for networking. I also have a PCIe-connected Wi-Fi card installed, which WSL2 consistently uses as the uplink interface for reasons unknown to me.
List of things I have attempted which made no difference at all and did not solve the issue:
netsh int ip reset
, netsh winsock reset
cmdservice
, hns
, vmcompute
, lxssmanager
and re-start those servicesWorkaround:
It is surprising to me that there is no option to select desired uplink network interface for the Hyper-V Default Switch or NAT solution. This would solve the issue.
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!
I am still experiencing the issue exactly as described. I'm sure many others also are. This issue should not be closed.
Microsoft Windows [Version 10.0.19025.1]
Any network activity from inside WSL2 ends up with:
ifconfig -a
reports:vEthernet (WSL)
adapter is present and enabled and reports no problems.It all worked fine till today. Today it stopped working with absolutely no apparent reason. No installations, no updates ...
I tried everything except reinstalling the whole system (which apparently I won't do, since I'll install release if decide to remove insider's), nothing helps.