Repository navigation
Description
Microsoft Windows [Version 10.0.19043.1081]
Ubuntu 20.04.2 LTS
I worked through the instructions for installing wsl for windows 10, from:
https://docs.microsoft.com/en-us/windows/wsl/install-win10
However, I cannot connect to the internet from Ubuntu. I switched off the firewall as suggested here:
https://docs.microsoft.com/en-us/windows/wsl/faq#why-do-i-not-have-internet-access-from-wsl-
But still could not connect.
There are a few things I have tried already but they did not resolve the problem (see below).
As in the FAQ page:
https://docs.microsoft.com/en-us/windows/wsl/faq#where-can-i-provide-feedback-
I raised this through the issues tracker but did not get any response.
Can someone help with this, please? I don't know why my previous request was closed without any response.
Thanks!
From Ubuntu terminal I tried to install:
curl https://get.volta.sh | bash
(6) Could not resolve host: get.volta.sh
so I tried:
ping 8.8.8.8
ping: connect: Network is unreachable
Some of the troubleshooting steps I have tried (which did not work)
-
Disabled the firewall.
-
Re-installed ubuntu.
-
BT (my internet provider), port forwarding: https://www.bt.com/help/broadband/learn-about-broadband/how-do-i-set-up-port-forwarding-on-my-bt-hub-
-
Checked Network Connection settings
Ethernet Properties
vEthernet Properties (WSL)
Hyper-V Virtual Ethernet Adapter
Internet Protocol Version 4 (TCP/IPv4) -checked
Internet Protocol Version 6 (TCP/IPv6) -checked
Hyper-V Extensible Virtual Switch -unchecked -
Checked Device Manager (View Hidden)
Network adapters > Hyper-V Virtual Ethernet Adapter Properties
Device status - This device is working properly. -
Turn Windows features on and off
Uncheck Windows Subsystem for Linux
Windows needs to reboot your PC to finish the requested changes
Recheck Windows Subsystem for Linux
Windows needs to reboot -
Change the nameserver
sudo nano /etc/resolv.conf
'# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/resolv.conf
'# [network]
'# generateResolvConf = false
nameserver xxx.xx.xx
Change the name server to 8.8.8.8 and save the file. You should now be able to connect to the internet.
-even restarted ubuntu, same error after restarting and the nameserver seems to be reset to default -
No network connection in any distribution under WSL 2 #5336 (comment)
Open Powershell or Cmd as Administrator
and run each of these commands:
wsl --shutdown
netsh winsock reset
netsh int ip reset all
netsh winhttp reset proxy
ipconfig /flushdns
Hit the Windows Key,
type Network Reset,
hit enter.
You should see this window.
Click "Reset now".
Restart Windows
Activity
car-meows commentedon Jul 2, 2021
As you can see from the comment, you should edit the
/etc/wsl.confto include the following:to prevent
/etc/resolv.confto be reset.markko1-pro commentedon Jul 3, 2021
I'm not an expert, but I think resolv.conf does not play a role here, since resolv.conf is used only for resolving DNS names.
If pinging 8.8.8.8 (Google DNS server) directly does not work, then the issue is elsewhere.
Do you use a VPN? I think there is an ongoing issue with VPN vs WSL2
sb5346 commentedon Jul 3, 2021
Thank you, @patrick330602 and Marko Vachtel (@markko1-pro) for getting back to me.
So should I edit the /etc/wsl.conf file?
I do not use VPN. I'm using wsl2.
car-meows commentedon Jul 3, 2021
Yep
sb5346 commentedon Jul 3, 2021
Thank you, @patrick330602.
I edited /etc/wsl.conf to add the lines:
I then edited the /etc/resolv.conf
to change the name server from the default :
Closed Ubuntu, reopened it tried:
and got:
As I understand Ubuntu should be ready to go once you install it and you should not have to edit config files. However, for me, it has not and I don't know why. And also, despite editing the config files, I still cannot connect to the internet from the WSL.
markko1-pro commentedon Jul 4, 2021
One other thing you could try - disable your antivirus for a while and see whether it helps. I had a similar problem with Kaspersky antivirus. Thankfully our IT allowed me to remove this curse from my PC :)
sb5346 commentedon Jul 4, 2021
Thank you, Marko Vachtel (@markko1-pro). I did try that already as it seemed the most likely problem. However, it didn't make a difference.
I had just previously installed Ubuntu and did have connection to the internet in order to download and install packages. However, my computer crashed and I had to do a factory reset. It's after this that I have not been able to connect to the internet from the wsl. I reinstalled, then uninstalled and reinstalled Ubuntu but the problem remains.
My first thought was that it might be the firewall, my computer seems to come with a preinstalled (temporary licence) antivirus software. It had previously expired and I had removed it but with resetting the computer, it got reinstalled.
Regardless of that, I did try the steps I listed above several times, in different orders in case that made a difference. But it doesn't.
sb5346 commentedon Jul 4, 2021
By the way, while this problem relates to an Ubuntu installation, I did also try a different wsl distribution, Kali. Which when you download and install from the Microsoft Store comes without any packages.
When I tried:
sudo apt update
I got a network error there as well.
grovertb commentedon Jul 4, 2021
Until 2 days ago it worked normally, but from one moment to another the internet connection in wsl2 was blocked and I no longer have an internet connection. However, I connected the internet to my pc from another provider and if I can have an internet connection in ubuntu. But with the other internet provider I have no connection in ubuntu.
PavelSosin-320 commentedon Jul 6, 2021
GroverTB (@grovertb) All networking utilities, including ping from systemd based distros (Ubuntu, Debian,Fedora,Suse) assume that the network stack is built around 2 services systemd-networkd for links configuration and systemd-resolved for name resolution. If these services failed to start or don't function correctly there is no chance to have networking functional. Could you try networkctl and resolvectl in both cases as a networking "smoke test"? Both services have very flexible configurations and autoconfiguration mechanisms to ensure stable networking via any infrastructure but leave resolve.conf out-of-the-game.
craigloewen-msft commentedon Jul 6, 2021
If you're seeing this issue, could you please collect networking logs and post them here in this thread?
Instructions here on how to collect these. Thanks!
Could be related to this bug: #7135
PavelSosin-320 commentedon Jul 6, 2021
I suppose that WSL provides eth0 interface to the distro in the way that is independent from Internet provider. But every ISP use its own hardware and software to connect end-machine to the global infrastructure. If network interface is swon as routable by the networkctl and resolved has sufficient DNS configuration - designated DNS is reachable then WSL does its job well but some Linux configuration is missed or can't be autoconfigured. The issues on the ISP side are also possible. MTR utility helps to know how far your can reach through the WSL VM-Host-Router-... Service provider chain.
sb5346 commentedon Jul 6, 2021
Craig Loewen (@craigloewen-msft), is that directed at me or to PavelSosin-320 / GroverTB (@grovertb)?
Can you help with the issue I have raised?
Thanks.
craigloewen-msft commentedon Jul 6, 2021
@sbhatti534602210 that comment is to anyone who is seeing this issue where you've upgraded your Windows version and your network stops working in WSL. Collecting those logs will help us resolve this issue!
To my understanding your issue is the same as the above, so collecting logs and posting them here is the best way for us to look into this.
32 remaining items
lukexodus commentedon Feb 12, 2023
Try to use another wi-fi router. I've also done all the steps you've done and they haven't fixed the problem. After using another router (a pocket wifi actually) wsl connects now to the internet. So, I concluded that the problem was on my router, not on wsl or my computer...
deckyfx commentedon Oct 12, 2023
happened to me today, is there no solution?
keith-horton commentedon Nov 14, 2023
If you are having name resolution issues, please look at troubleshooting documentation we just added here: https://github.com/MicrosoftDocs/WSL/blob/main/WSL/troubleshooting.md#troubleshooting-dns-in-wsl.
It walks through some configurations which can break name resolution from the WSL container - as well as a work around for an HNS issue which can also break connectivity.
keith-horton commentedon Nov 14, 2023
There are compatibility issues with some VPNs which want to see all packets from the top of the stack.
Some compat issues with VPNs can be addressed by updating the interface metrics so the vNIC for WSL is more preferred than the VPN interface. We document this https://learn.microsoft.com/en-us/windows/wsl/troubleshooting, see the sections "WSL has no network connectivity once connected to a VPN" and "Cisco Anyconnect VPN issues with WSL in NAT mode".
Puvipavan commentedon Nov 18, 2023
The solution worked for me is(I do not use Hyper-V, Maybe you could do other way around if you use Hyper-V):
Turning on Hyper-V does some magic :P I had to do the same after installing updates too.
Note: I wasn't experiencing name resolution issue
vadimkantorov commentedon Nov 21, 2023
Keith Horton (@keith-horton) This has just occurred for me after months of this being not happening:
Temporary failure in name resolution, ping of goolge by IP still worksnslookupcrashes in a bad waythis is on
Puvipavan commentedon Nov 21, 2023
Vadim Kantorov (@vadimkantorov) It's DNS issue. You need to explore about "fixing DNS issue on WSL".
vadimkantorov commentedon Nov 21, 2023
I checked https://github.com/MicrosoftDocs/WSL/blob/main/WSL/troubleshooting.md#troubleshooting-dns-in-wsl. I don't think my situation is described there, but I don't have time/skills for a deeper investigation.
I just thought that the
nslookupcrash and stack trace is interesting, I don't think I saw it in this discussion, so I hope it's helpful for further people reporting. Might be it's a different flavor of DNS problems issuesPuvipavan commentedon Nov 21, 2023
Vadim Kantorov (@vadimkantorov) try this: #7141 (comment)
vadimkantorov commentedon Nov 21, 2023
>>to append instead of rewriting>chattr: Operation not supported while reading flags on /etc/resolv.conf, despite sudo;; communications error to ::1#53: timed out<- this is beforewsl --shtudownnameservers 8.8.8.8instead ofnameserver 8.8.8.8wsl --shutdownyeah, maybe the problems is that resolv.conf sometimes doesn't get regenerated after hibernate recovery on a new Wi-Fi network
keith-horton commentedon Nov 28, 2023
I highly recommend doing this step #4 if you are using NAT and having DNS issues:
Stop WSL
wsl.exe –shutdown
Delete the old HNS Firewall rule. This Powershell command should work in most cases: 1.Get-NetFirewallRule -Name "HNS*" | Get-NetFirewallPortFilter | where Protocol -eq UDP | where LocalPort -eq 53 | Remove-NetFirewallRule
Remove all HNS endpoints
Note: if HNS is used to manage other containers, such as MDAG or Windows Sandbox, those should also be stopped.
hnsdiag.exe delete all
Reboot or restart the HNS service
When WSL is restarted, HNS will create new Firewall rules, correctly targeting the WSL interface.
EDIT: by #4, I mean #4 from the above link for troubleshooting DNS in WSL.
murdoc99gtp commentedon May 10, 2024
I know this thread is a few years old. Was there a fix determined for this issue? I am having the exact same issue with the same board series, ROG Strix Z690-E Gaming motherboard on Windows 11. The z690 onboard LAN will not connect to my cisco catalyst ws-c3550. But I have four other intel chipset motherboards (z670 prime, z170, h81 & z68) that have no problem connecting.
krnaveen14 commentedon Jul 16, 2024
I faced same issue in my Work Desktop (connected to corporate network). Setting the DNS nameserver to
8.8.8.8doesn't make sense as it would make internal sites unresolvable.I came up the following solution as a workaround - Fix for WSL2 No Internet
1) Find DNS Server used by Windows
2) Set DNS Nameserver in WSL
craigloewen-msft commentedon May 27, 2025
I'm closing out old issues. If you're still seeing this, please reopen a new issue! Thank you!