Skip to content

No network access from WSL/Ubuntu #7141

Closed

Description

@sb5346

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)

  1. Disabled the firewall.

  2. Re-installed ubuntu.

  3. 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-

  4. 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

  5. Checked Device Manager (View Hidden)
    Network adapters > Hyper-V Virtual Ethernet Adapter Properties
    Device status - This device is working properly.

  6. 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

  7. 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

  8. 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

  1. car-meows commented on Jul 2, 2021

    @car-meows

    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

    As you can see from the comment, you should edit the /etc/wsl.conf to include the following:

    [network]
    generateResolvConf = false
    

    to prevent /etc/resolv.conf to be reset.

  2. markko1-pro commented on Jul 3, 2021

    @markko1-pro

    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

  3. sb5346 commented on Jul 3, 2021

    @sb5346
    Author

    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.

  4. car-meows commented on Jul 3, 2021

    @car-meows

    So should I edit the /etc/wsl.conf file?

    Yep

  5. sb5346 commented on Jul 3, 2021

    @sb5346
    Author

    Thank you, @patrick330602.
    I edited /etc/wsl.conf to add the lines:

    [network]
    generateResolvConf = false

    I then edited the /etc/resolv.conf
    to change the name server from the default :

    nameserver 8.8.8.8

    Closed Ubuntu, reopened it tried:

    ping 8.8.8.8

    and got:

    ping: connect: Network is unreachable

    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.

  6. markko1-pro commented on Jul 4, 2021

    @markko1-pro

    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 :)

  7. sb5346 commented on Jul 4, 2021

    @sb5346
    Author

    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.

  8. sb5346 commented on Jul 4, 2021

    @sb5346
    Author

    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.

  9. grovertb commented on Jul 4, 2021

    @grovertb

    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.

  10. PavelSosin-320 commented on Jul 6, 2021

    @PavelSosin-320

    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.

  11. craigloewen-msft commented on Jul 6, 2021

    @craigloewen-msft
    Member

    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

  12. PavelSosin-320 commented on Jul 6, 2021

    @PavelSosin-320

    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.

  13. sb5346 commented on Jul 6, 2021

    @sb5346
    Author

    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.

  14. craigloewen-msft commented on Jul 6, 2021

    @craigloewen-msft
    Member

    @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.

  15. 32 remaining items

  16. lukexodus commented on Feb 12, 2023

    @lukexodus

    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...

  17. deckyfx commented on Oct 12, 2023

    @deckyfx

    happened to me today, is there no solution?

  18. keith-horton commented on Nov 14, 2023

    @keith-horton
    Member

    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.

  19. keith-horton commented on Nov 14, 2023

    @keith-horton
    Member

    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".

  20. Puvipavan commented on Nov 18, 2023

    @Puvipavan

    The solution worked for me is(I do not use Hyper-V, Maybe you could do other way around if you use Hyper-V):

    • Turn on Hyper-V from the Windows Features
    • Restart
    • Turn off Hyper-V from the Windows Features
    • Restart

    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

  21. vadimkantorov commented on Nov 21, 2023

    @vadimkantorov

    Keith Horton (@keith-horton) This has just occurred for me after months of this being not happening:

    1. After recovery from hibernate on a different Wi-Fi network, in cmd.exe I can ping google.com
    2. in existing WSLv1 session and on new WSLv1 session, DNS lookups stopped working: Temporary failure in name resolution, ping of goolge by IP still works
    3. nslookup crashes in a bad way
    4. gdb with bt doesn't work :(
    image image image image
    Starting program: /usr/bin/nslookup
    warning: opening /proc/PID/mem file for lwp 2496.2496 failed: No such file or directory (2)
    Failed to read a valid object file image from memory.
    [New LWP 2499]
    > google.com
    ;; UDP setup with fec0:0:0:ffff::1#53(fec0:0:0:ffff::1) for google.com failed: invalid file.
    ;; UDP setup with fec0:0:0:ffff::1#53(fec0:0:0:ffff::1) for google.com failed: invalid file.
    ;; UDP setup with fec0:0:0:ffff::1#53(fec0:0:0:ffff::1) for google.com failed: invalid file.
    ;; UDP setup with fec0:0:0:ffff::2#53(fec0:0:0:ffff::2) for google.com failed: invalid file.
    ;; UDP setup with fec0:0:0:ffff::3#53(fec0:0:0:ffff::3) for google.com failed: invalid file.
    task.c:805: INSIST((task->events).head != (event)) failed, back trace
    /lib/x86_64-linux-gnu/libisc-9.18.12-0ubuntu0.22.04.3-Ubuntu.so(+0x32b13)[0x7fffff212b13]
    /lib/x86_64-linux-gnu/libisc-9.18.12-0ubuntu0.22.04.3-Ubuntu.so(isc_assertion_failed+0x10)[0x7fffff212780]
    /lib/x86_64-linux-gnu/libisc-9.18.12-0ubuntu0.22.04.3-Ubuntu.so(isc_task_run+0x422)[0x7fffff239fd2]
    /lib/x86_64-linux-gnu/libisc-9.18.12-0ubuntu0.22.04.3-Ubuntu.so(+0x2653e)[0x7fffff20653e]
    /lib/x86_64-linux-gnu/libisc-9.18.12-0ubuntu0.22.04.3-Ubuntu.so(+0x26cb7)[0x7fffff206cb7]
    /lib/x86_64-linux-gnu/libisc-9.18.12-0ubuntu0.22.04.3-Ubuntu.so(+0x26ed6)[0x7fffff206ed6]
    /lib/x86_64-linux-gnu/libuv.so.1(+0x91ed)[0x7ffffec891ed]
    /lib/x86_64-linux-gnu/libuv.so.1(+0x2511e)[0x7ffffeca511e]
    /lib/x86_64-linux-gnu/libuv.so.1(uv_run+0x678)[0x7ffffec8ec88]
    /lib/x86_64-linux-gnu/libisc-9.18.12-0ubuntu0.22.04.3-Ubuntu.so(+0x2734a)[0x7fffff20734a]
    /lib/x86_64-linux-gnu/libisc-9.18.12-0ubuntu0.22.04.3-Ubuntu.so(isc__trampoline_run+0x1a)[0x7fffff23dd4a]
    /lib/x86_64-linux-gnu/libc.so.6(+0x94ac3)[0x7ffffed54ac3]
    /lib/x86_64-linux-gnu/libc.so.6(clone+0x44)[0x7ffffede5bf4]
    
    Thread 2 "isc-net-0000" received signal SIGABRT, Aborted.
    [Switching to LWP 2499]
    0x00007ffffed569fc in ?? ()
    (gdb) thread apply all bt
    
    Thread 2 (LWP 2499 "isc-net-0000"):
    #0  0x00007ffffed569fc in ?? ()
    Backtrace stopped: Cannot access memory at address 0x7ffffbd4c3e0
    
    Thread 1 (LWP 2496 "nslookup"):
    #0  0x00007ffffed0321a in ?? ()
    Backtrace stopped: Cannot access memory at address 0x7ffffffedf80
    (gdb) bt
    #0  0x00007ffffed569fc in ?? ()
    Backtrace stopped: Cannot access memory at address 0x7ffffbd4c3e0
    

    this is on

    Description:    Ubuntu 22.04.3 LTS
    Release:        22.04
    Codename:       jammy
    
  22. Puvipavan commented on Nov 21, 2023

    @Puvipavan

    Vadim Kantorov (@vadimkantorov) It's DNS issue. You need to explore about "fixing DNS issue on WSL".

  23. vadimkantorov commented on Nov 21, 2023

    @vadimkantorov

    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 nslookup crash 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 issues

  24. Puvipavan commented on Nov 21, 2023

    @Puvipavan
  25. vadimkantorov commented on Nov 21, 2023

    @vadimkantorov
    • the second command probably should use >> to append instead of rewriting >
    • chattr failed: chattr: Operation not supported while reading flags on /etc/resolv.conf, despite sudo
    • nslookup started timing out ;; communications error to ::1#53: timed out <- this is before wsl --shtudown
    • the first command has incorrect syntax: nameservers 8.8.8.8 instead of nameserver 8.8.8.8
    • after fixing it, the new resolv.conf started working, even without wsl --shutdown
    • some offending nameservers:
    nameserver fec0:0:0:ffff::1
    nameserver fec0:0:0:ffff::2
    nameserver fec0:0:0:ffff::3
    

    yeah, maybe the problems is that resolv.conf sometimes doesn't get regenerated after hibernate recovery on a new Wi-Fi network

  26. keith-horton commented on Nov 28, 2023

    @keith-horton
    Member

    I highly recommend doing this step #4 if you are using NAT and having DNS issues:

    1. The HNS Firewall rule to allow the DNS packets to shared access can become invalid, referencing a previous WSL interface identifier. This is a flaw within HNS which has been fixed with the latest Windows 11 release. On earlier releases, if this occurs, it’s not easily discoverable, but it has a simple work around:

    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.

  27. murdoc99gtp commented on May 10, 2024

    @murdoc99gtp

    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 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.

  28. krnaveen14 commented on Jul 16, 2024

    @krnaveen14

    I faced same issue in my Work Desktop (connected to corporate network). Setting the DNS nameserver to 8.8.8.8 doesn'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

    # 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
  29. craigloewen-msft commented on May 27, 2025

    @craigloewen-msft
    Member

    I'm closing out old issues. If you're still seeing this, please reopen a new issue! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions