-
Notifications
You must be signed in to change notification settings - Fork 847
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 access from WSL/Ubuntu #7141
Comments
As you can see from the comment, you should edit the
to prevent |
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. |
Thank you, @patrick330602 and @markko1-pro for getting back to me. I do not use VPN. I'm using wsl2. |
Yep |
Thank you, @patrick330602.
I then edited the /etc/resolv.conf
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. |
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 :) |
Thank you, @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. |
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. |
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. |
@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. |
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 |
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. |
@craigloewen-msft, is that directed at me or to @PavelSosin-320 / @grovertb? |
@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. |
Thank you @craigloewen-msft |
@sbhatti534602210 The network stack of Ubuntu and other "mature" Linux distros is built around the 2 systemd driven services: systemd-networkd and systemd-resolved. Both services have self-documented configuration files in /etc/systemd/ folder and use the autoconfiguration mechanism. The networkctl and resolvectl allow interactive configuration and testing networking and name resolution instantly. If networkctl sees eth0 (internet) interface as "routable" then WSL provides a network to WSL VM and the internet is accessible. Otherwise, either there is a bug in the WSL Network switch or internet access is blocked by security or eth0 provisioning takes too long and ends with a timeout. In the case of routing via VPN, some additional WSL Kernel features (TUP/TAN support) may be needed or only additional configuration to make the Linux networking stack working. |
@benhillis The prove that WSL networking is OK and the root cause is outside WSL: Jul 07 07:55:50 MSI-wsl NetworkManager[101]: [1625633750.6964] device (eth0): state change: disconnected -> prepare (reason 'none', sys-iface-state: > Context:
|
Thank you @PavelSosin-320. I'm sorry, from your message I did not understand what I need to do that I have not done already. Can you specify? |
Hello, same issue here. WSL2 reinstalled from scratch, Ubuntu (tried ArchLinux as well) freshly installed, run wsl and I get
roberto@WoT:~$ ip address 1: lo: mtu 65536 qdisc noop state DOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: bond0: mtu 1500 qdisc noop state DOWN group default qlen 1000 link/ether 86:e6:ce:f6:ac:34 brd ff:ff:ff:ff:ff:ff 3: dummy0: mtu 1500 qdisc noop state DOWN group default qlen 1000 link/ether 1e:fe:2b:f1:3e:4a brd ff:ff:ff:ff:ff:ff 4: eth0: mtu 1500 qdisc noop state DOWN group default qlen 1000 link/ether 00:15:5d:ca:74:7f brd ff:ff:ff:ff:ff:ff 5: tunl0@NONE: mtu 1480 qdisc noop state DOWN group default qlen 1000 link/ipip 0.0.0.0 brd 0.0.0.0 6: sit0@NONE: mtu 1480 qdisc noop state DOWN group default qlen 1000 link/sit 0.0.0.0 brd 0.0.0.0 and # This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf: # [network] # generateResolvConf = false nameserver 172.18.128.1 It used to work with 1903 and 1909 if I remember correctly. I checked that as well and apparently systemd is not even used: roberto@WoT:~$ systemctl status NetworkManager System has not been booted with systemd as init system (PID 1). Can't operate. Failed to connect to bus: Host is down |
Hi Saira. 1). You may use WiFi router running OpenWRT Linux OS that can
work as a proxy DNS service by itself but has its own flexible and
effective configuration. Its IP 192 .168.1.1 can be used as a primary DNS
with under 2ms response time. 2). If you run WSL distro with enabled
systemd its resolved service has its own very flexible configuration and
autoconfiguration features that allow improvement in security and
performance via negotiation with global DNS services and smart,
quality-based caching of results. 3. Every Global DNS service 8.8.8.8,
9.9.9.9 offers different privacy agreements and secure protocol support.
The nearest deployed instance is just a few miles from your location, i.e.
"over the street" response time. Systemd's resolvectl util provides quality
info about "probed" DNS's.
|
@PavelSosin-320 (and a few others), this issue is about |
The "secret" place of Windows 10 configuration in the registry you can see
in the attachment. It is the partial analog of the Linux resolved.conf I
suppose that Chrome and Chromium-based Edge use it. I have no idea whether
WSL without systemd can use it. It can contradict the Company's security
policy!!!
|
Addendum: if I set WSL to use version 1 ( |
@keltia WSL1 uses Windows network stack, WSL2 has its own network stack - this is the difference. You don't need another init because all WSL distro based on mature Linux distros either use special scripts (Ubuntu) installed with the distro or have the corresponding systemd-genie package that boots and login system using systemd. Not all WSL distros in the MS Store are of the same quality. Ubuntu 20.04 is not more valuable than 18.04 because the current maintained Ubuntu version is 20.10. Almost all valuable Ubuntu packages are in the 20.10 repository today. I have no idea why MS keeps 18.04. Maybe, because it is LTS and still supported by Canonical. |
@PavelSosin-320 my point is that I don't understand why it makes such a difference, it was definitely working in WSL2 a few months ago now it doesnt. Switching to WSL1 (which I didn't run before) makes it work, I'm puzzled. |
@keltia WSL1 and WSL2 use different networking stack because WSL2 VM uses its own Linux Kernel. Linux networking is provided by the Linux Kernel (keep it updated using wsl --update!!!) and several Linux services heavily dependent on the Kernel version capability and distro's version. These Linux packages are the most frequently updated part of Linux in our days due to fast infrastructure changes and security requirements. Windows 11 is a good example of poor reaction on Internet infrastructure changes. WSL1 has no own Linux Kernel and uses Windows networking stack. It changes very slow and today it lags many years behind the current Internet infrastructure state of technology. Microsoft upgraded Windows networking to offer Microsoft 365 but left WSL2 behind. |
I just did the same as keltia and the results were very poor: I got my ISP's DNS - the rust piece of iron maintained occasionally with regular long downtimes and hours long synchronisation lag. It doesn't support the basic security features except "antivirus" for extra money. The communication cost of using GoogleDNS, Cloudfare or Quad9 is neglectable for me. |
In addition: I just configure my Win 11 to use Quad9 IPV6 as primary IPV6 DNS and Cloudfare IPV6 DNS as alternative IPV6 DNS. My browsers are cruising! |
This same issue affects Windows Sandbox. No internet connectivity. There is no vEthernet adapter. Tried creating one, but it won't connect: unidentified network. I've got two machines side-by-side with fresh installs of windows, updated, no other software. One works and one does not. Only difference is hardware. Maybe something about the ethernet controller or driver that Hyper-V doesn't like? I can get a working vEthernet by connecting to my wifi adapter, but still no connect in wsl2 or sandbox. |
I got it working by not using ethernet adapter and using wifi adapter. It was mentioned in one of these billion Issues logged on the subject, but I couldn't get it working the first time I tried. I uninstalled all the virtualization features & wsl. I then installed only Hyper-V. Created my wifi v switch and made sure it was working. (Here, I also tried creating an ethernet v switch, but it would not connect: Unidentified network. I wish I had a different ethernet card to plug in and test. I think the problem is tied to the ethernet card in use or it's driver.) Then I installed Sandbox & WSL + Ubuntu. Now it is all working. Not correctly. It's a stupid workaround that I don't won't to use. I don't want to use wifi for this, and prefer to have my wifi disabled on the computer. The ethernet adapter on the other computer sitting next to me works just fine, out of the box. Why not this one? |
I updated the |
finally got it working :)
|
My probably related report: #8299 My current workaround: open a new WSLv1 tab and ping google.com in it, then the old WSLv1 bash processes start to work somehow, but maybe it's a coincidence |
I have the same problem. Tried all steps above. I found out that if I switched to Wifi that my problem is resolved.. I still don't know why the ubuntu doesnt have internet on cable internet.. it's only the cable internet that has the problem. |
I have the same problem but I fixed it by changing the |
Some other network driver is blocking WSL network. Uninstalling my VPN app solved the problem |
I had the same exact problem as the OP @sbhatti534602210, and even tried all of the things they tried. What finally worked for me was suggested in this thread: https://superuser.com/a/1733426/1725434 . They suggest decompressing the files in My system was running low on hard drive space so I think Windows 10 started to compress files automatically to save space. Or you can disable the auto-compression system-wide by running Hope this helps others. |
For those that using Comodo antivirus/firewall, you definitely need to disable firewall (like suggested by many) in order to make network working in WSL Ubuntu. |
I was facing this issue only under corporate firewall (Zscaler). Otherwise, WLS Ubuntu was able to connect to the network. As suggested in this thread, some interaction of Hyper-V or Hyper-V plus docker desktop was the root cause for me. The steps I took:
System reboots at this level. When I try to start the ubuntu app on my laptop, it fails with error 0x80370102. In this thread, someone suggests to enable Hyper-V to avoid this error. But, this solution worked for me:
That's it. Once installation is over, there is no networking issue even when it's behind corporate firewall. However, I will suggest to try the following simple steps first:
|
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... |
happened to me today, is there no solution? |
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. |
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". |
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 |
@keith-horton This has just occurred for me after months of this being not happening:
this is on
|
@vadimkantorov It's DNS issue. You need to explore about "fixing DNS issue on WSL". |
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 |
@vadimkantorov try this: #7141 (comment) |
yeah, maybe the problems is that resolv.conf sometimes doesn't get regenerated after hibernate recovery on a new Wi-Fi network |
I highly recommend doing this step #4 if you are using NAT and having DNS issues:
Stop WSL EDIT: by #4, I mean #4 from the above link for troubleshooting DNS in WSL. |
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. |
I faced same issue in my Work Desktop (connected to corporate network). Setting the DNS nameserver to I came up the following solution as a workaround - Fix for WSL2 No Internet 1) Find DNS Server used by Windows # 10.9.8.169 is the DNS Server in my system (Corporate Device / Network)
ipconfig /all | findstr /R "DNS\ Servers" 2) Set DNS Nameserver in WSL sudo bash -c "echo 'nameserver <dns_server_from_prev_cmd>' > /etc/resolv.conf"
# For personal devices without DNS Server configured, use 8.8.8.8 or any other preferred resolver |
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
The text was updated successfully, but these errors were encountered: