How can I fix internet connection issues on wsl2

Just got on wsl2 and when I run sudo apt-get update I get the following error archive.ubuntu.com:80 (2001:503:83eb::30). - connect (101: Network is unreachable. What am I missing here?

Note: I am on the official release to the public windows-10 updates 2004

distro ubuntu 20.04 LTS

According to old similar issues I should disable Avast, well in my case I don't have avast installed

This is all the error

bihire@DESKTOP-UJES0GS:~$ sudo apt-get update
[sudo] password for bihire:
Get:1 focal-security InRelease [107 kB]
Get:2 focal-security/main amd64 Packages [101 kB]
Get:3 focal-security/main Translation-en [37.8 kB]
Get:4 focal-security/main amd64 c-n-f Metadata [2612 B]
Get:5 focal-security/restricted amd64 Packages [10.9 kB]
Get:6 focal-security/restricted Translation-en [2972 B]
Get:7 focal-security/universe amd64 Packages [34.1 kB]
Get:8 focal-security/universe Translation-en [16.6 kB]
Get:9 focal-security/universe amd64 c-n-f Metadata [1428 B]
Get:10 focal-security/multiverse amd64 Packages [1172 B]
Get:11 focal-security/multiverse Translation-en [540 B]
Get:12 focal-security/multiverse amd64 c-n-f Metadata [116 B]
Err:13 focal InRelease Cannot initiate the connection to archive.ubuntu.com:80 (2001:503:a83e::2:30). - connect (101: Network is unreachable)
5

5 Answers

I was having the same issue. As the comment above suggested I disabled IPv6 option for both, my wireless adapter and WSL Ethernet adapter.

Follow the steps:

  1. Right click on your network icon, and click on Open Network and Internet settingsimage
  2. In the settings page look for Change adapter options under Advanced Network settingsimg
  3. On the next page you'll see a bunch of network adapters, for bluetooth, vpns, ethernet and for wifi.
  4. If you use wifi, then disable IPv6 for wifi and wsl adapters.
  5. Right click on the adapter and click Properties
  6. In the pop up look for a checkbox specifying IPv6 connection, uncheck it. img

I was trying to comment at first then couldn't (less reputations).

2

With my latest windows 10 ver 21H1 (OS Build 19043.1165) and the latest WSL2 Ubuntu-18.04. (On windows 11 Insider ver 21H2 (OS Build 22000.168) and fresh install of wsl2 ubuntu 18.04 it works well, the .wslconfig is correctly set with swapfile=0, it could be that when upgrading on the windows 10 from wsl1 to wsl2, since the .wslconfig was already there, that it was not freshly created correctly).

Thus, the simple procedure that works is to modify the c:\users%USERPROFILE%.wslconfig file to be:

[wsl2]
memory=8GB
**swapFile=0**
swap=0

c:> wsl --shutdown c:> wsl

For some reason someone at microsoft changed the name of the swap config parameter. Stragely, when swapfile=0 is defined. wsl2's network works like a whistle.

Microsoft: Please decouple swalfile from network. And consider supporting both names for the swap.

1

For me it was the Symantec Endpoint Protection agent that was blocking IP traffic to/from WSL2. In the app, go to menu Change Settings > configure settings for Network and Host Exploit Mitigation > and select the option Allow IP traffic.

I had same experience with ubuntu distro wsl 2 (win10):

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.3 LTS
Release: 20.04
Codename: focal

What I did is I updated the etc/hosts.

  • edit your hosts: sudo vi etc/hosts

  • find the following lines that are desirable for IPv6 capable hosts then comment those lines. No need to disable IPv6 in your network.

    ::1 ip6-localhost ip6-loopback
    fe00::0 ip6-localnet
    ff00::0 ip6-mcastprefix
    ff02::1 ip6-allnodes
    ff02::2 ip6-allrouters
  • save (esc + x )

  • try ping google.com

Hope this helps.

I had mine working as a miner, both Ubuntu and Debian, changed Internet providers and both stop connecting to the mining pool and couldn't do the update or upgrades.

The easy fix was:

sudo nano /etc/resolv.conf

and changing nameserver to nameserver 8.8.8.8.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like