WSL icon indicating copy to clipboard operation
WSL copied to clipboard

[WSL2/Ubuntu/Debian/Kali] Network not configured

Open ericct opened this issue 6 years ago • 43 comments

Windows build number: version 2004 Build 19041.264

I've removed all WSL/WSL2 components and Docker before installing only WSL/WSL2. I have the same behaviour on 4 distributions (Ubuntu 18.04/20.04, Debian 10, Kali Linux 2020.1).

All coming lines are from Ubuntu 20.04.

When started, I cannot get any connection. eth0 interface is down and not configured:

ip addr show eth0
4: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 00:15:5d:3c:76:f7 brd ff:ff:ff:ff:ff:ff

Using ipconfig from Windows gives me information about needed network configuration:

Ethernet adapter vEthernet (WSL):

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::a0cf:c53c:da4:86ef%53
   IPv4 Address. . . . . . . . . . . : 172.31.208.1
   Subnet Mask . . . . . . . . . . . : 255.255.240.0
   Default Gateway . . . . . . . . . :

I then manually configure eth0 and add a default route:

sudo ip address add 172.31.208.10/20 broadcast 172.31.223.255 dev eth0
sudo ip route add default via 172.31.208.1

Now the interface:

ip addr show eth0
4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:15:5d:3c:76:f7 brd ff:ff:ff:ff:ff:ff
    inet 172.31.208.10/20 brd 172.31.223.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::215:5dff:fe3c:76f7/64 scope link
       valid_lft forever preferred_lft forever

and the route:

ip route
default via 172.31.208.1 dev eth0
172.31.208.0/20 dev eth0 proto kernel scope link src 172.31.208.10

are correct (network connections are working).

What's not working: network is not fully configured Expected behaviour: have inet fully configured without manual intervention. Also, the network settings change at each reboot, raising the need for this operation after each reboot.

ericct avatar May 28 '20 15:05 ericct

Hello Fellow Devs 😊

I had an error using WSL2 and Ubuntu 20.04 Seems like the /etc/resolv.conf generates an incorrect nameserver adjusting this nameserver manually my connection start to working again.

I've tried to disable the auto-generation of this nameserver adjusting the /etc/wsl.conf with:

[network]
generateResolvConf = false

this creates a linked file with .../run/resolvconf/resolv.conf that don't allows me to create a fixed one.

please let me know if you have any patch or remedy to this error.

Best regards.

betancour avatar May 29 '20 05:05 betancour

@betancour I set my DNS to the one being used on the host but that didn't help. I've tried solutions on the other issues and none of it has worked so far.

skippednote avatar May 29 '20 06:05 skippednote

@betancour I set my DNS to the one being used on the host but that didn't help. I've tried solutions on the other issues and none of it has worked so far.

Hi skippednote Regarding your message Did you use your router IP as the nameserver?

betancour avatar May 29 '20 06:05 betancour

@betancour By default it points to 172.20.32.1 which is Ethernet (WSL). I've tried changing it to 8.8.8.8 as well but that didn't help either.

skippednote avatar May 29 '20 06:05 skippednote

@betancour By default it points to 172.20.32.1 which is Ethernet (WSL). I've tried changing it to 8.8.8.8 as well but that didn't help either.

Hi Again @skippednote

I've tried using Google DNS unsuccessfully.

The way that works is when I use my router ip as nameserver Example:

 betancour  Inspiron-5570  mnt  d  Dev  $  sudo apt-get update
[sudo] password for betancour:
Err:1 https://deb.nodesource.com/node_12.x focal InRelease
  Temporary failure resolving 'deb.nodesource.com'
Err:2 http://archive.ubuntu.com/ubuntu focal InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Err:3 http://security.ubuntu.com/ubuntu focal-security InRelease
  Temporary failure resolving 'security.ubuntu.com'
Err:4 https://dl.yarnpkg.com/debian stable InRelease
  Temporary failure resolving 'dl.yarnpkg.com'
Get:5 http://archive.ubuntu.com/ubuntu focal-updates InRelease [107 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal-backports InRelease [98.3 kB]
Fetched 205 kB in 39s (5261 B/s)
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease  Temporary failure resolving 'security.ubuntu.com'
W: Failed to fetch https://deb.nodesource.com/node_12.x/dists/focal/InRelease  Temporary failure resolving 'deb.nodesource.com'
W: Failed to fetch https://dl.yarnpkg.com/debian/dists/stable/InRelease  Temporary failure resolving 'dl.yarnpkg.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
 betancour  Inspiron-5570  mnt  d  Dev  $  echo 'nameserver 192.168.1.1' >> /etc/resolv.conf
 betancour  Inspiron-5570  mnt  d  Dev  $  sudo apt-get update
Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [107 kB]
Hit:2 http://archive.ubuntu.com/ubuntu focal InRelease
Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease [107 kB]
Hit:4 https://dl.yarnpkg.com/debian stable InRelease
Hit:5 https://deb.nodesource.com/node_12.x focal InRelease
Get:6 http://archive.ubuntu.com/ubuntu focal-backports InRelease [98.3 kB]
Fetched 312 kB in 18s (17.8 kB/s)
Reading package lists... Done

betancour avatar May 29 '20 07:05 betancour

@betancour I'm seeing a similar output. What DNS address is working for you?

skippednote avatar May 29 '20 07:05 skippednote

Hi @skippednote as you can see I am using the 192.168.1.1

image

betancour avatar May 29 '20 07:05 betancour

@betancour This doesn't work for me. Only thing that work is reverting to WSL1

skippednote avatar May 29 '20 07:05 skippednote

There are two different things here:

  • one is to have a network route (initial topic), which sometimes apprently is not set (initial topic here)
  • another one is indeed name resolution

Default is to rely on the host machine for name resolution. /etc/resolv.conf is dynamically generated when WSL2 kernel starts. One can of course set another DNS IP.

But, there may also be a third problem with the firewall on the host, blocking communication for WSL2.

At the end, apt update problem can have multiple reasons.

ericct avatar May 29 '20 07:05 ericct

@ericct I don't have a VPN or Antivirus installed. I have tried with Windows Defender Firewall disabld.

skippednote avatar May 29 '20 07:05 skippednote

@betancour @ericct For me it was an issue with the ISP who had disabled post routing. After enabling it internet is working fine in WSL2.

skippednote avatar May 29 '20 11:05 skippednote

same here

eth0 is down every after reboot but i configure eth0 up, eth0 can't ip addr when i configure ip addr and route, network works fine

tokiedokie avatar May 29 '20 12:05 tokiedokie

same here

eth0 is down every after reboot but i configure eth0 up, eth0 can't ip addr when i configure ip addr and route, network works fine

Yes, this is the same case. I'm not alone!

It's really that the network is not fully configured, the other cases are other issues.

So, does anyone have a solution for this uncomplete network configuration (inside WSL2)?

ericct avatar May 29 '20 13:05 ericct

clean install windows works for me.

tokiedokie avatar May 30 '20 05:05 tokiedokie

clean install windows works for me.

Anotherway is deleting the account and log again with your account to set default parameters. thanks so much.

betancour avatar Jun 01 '20 16:06 betancour

I can't access the HTTPS network, but HTTP is OK

fanqisoft avatar Jun 02 '20 04:06 fanqisoft

Is it closed because it's fixed?

There are different problems reported in this thread, but the initial one seems to impact multiple people and while it seems to have work-arounds (more or less convenient), there's no clear status.

Is it just rejected as bug?

ericct avatar Jun 03 '20 07:06 ericct

This one got caught in the clicks, apologies. There is no repro here though. That's not on you, but without someone guessing the externality (the variable) it will be tough to turn into an actionable.

therealkenc avatar Jun 03 '20 10:06 therealkenc

To repro

  1. Fresh install Windows 10 2004
  2. Install WSL
  3. Convert any WSL distro to WSL 2
  4. Check updates on the converted repo,

betancour avatar Jun 04 '20 00:06 betancour

That is obviously not a repro. That it is a repro for you and confirmed by others, for reasons as yet unidentified, is not in question. But imagine, just for a moment, if that was actually a way to reproduce the issue. I am not sure it is even constructive to point this out. You cannot possibly imagine that posting those four steps contributes toward a better understanding of the nature of this issue.

(deep breath)

WAG try fiddling "ipv6 things". That's a usual suspect ref #4486.

therealkenc avatar Jun 04 '20 01:06 therealkenc