WSL icon indicating copy to clipboard operation
WSL copied to clipboard

No network connection in any distribution under WSL 2

Open duncanmmacleod opened this issue 6 years ago • 227 comments

Environment

Windows build number: 10.0.19041.0
Your Distribution version: Ubuntu-18.04
Whether the issue is on WSL 2 and/or WSL 1: WSL 2 only (Linux version 4.19.104-microsoft-standard (oe-user@oe-host) (gcc version 8.2.0 (GCC)) #1 SMP Wed Feb 19 06:37:35 UTC 2020)

Steps to reproduce

I have installed WSL 2 on a new Windows 10 Education machine managed by my employer (university) following the online instructions. Whenever I create a new distribution using WSL version 2 I have no network connection.

duncan@Macleod-XPS:/mnt/c/Users/spxdmm$ ping google.com
ping: google.com: Temporary failure in name resolution
duncan@Macleod-XPS:/mnt/c/Users/spxdmm$ ping 127.0.0.1
connect: Network is unreachable
duncan@Macleod-XPS:/mnt/c/Users/spxdmm$ ifconfig eth0
eth0: flags=4098<BROADCAST,MULTICAST>  mtu 1500
        ether 00:15:5d:a5:38:8b  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

duncan@Macleod-XPS:/mnt/c/Users/spxdmm$ cat /etc/resolv.conf
# 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 192.168.176.1

Gist of strace here: https://gist.github.com/duncanmmacleod/4a69a363bf990c3a0dead811b22ce6d5

If I use wsl --set-version to roll back the distribution to WSL 1 I get a network connection just fine.

Expected behavior

New distributions on WSL 2 have a working network connection out-of-the-box.

Actual behavior

See above

Thanks, sorry if this is a duplicate of an existing issue (I surely can't be the only one...)

duncanmmacleod avatar Jun 04 '20 14:06 duncanmmacleod

Try network reset or allow in firewall.

rescenic avatar Jun 04 '20 20:06 rescenic

Can you be any more specific about how to do either of those things? I'm new to Windows (just migrating back from macOS).

duncanmmacleod avatar Jun 04 '20 20:06 duncanmmacleod

Try something like ping 216.58.192.164. Does it work?

onomatopellan avatar Jun 04 '20 21:06 onomatopellan

$ ping 216.58.192.164
connect: Network is unreachable

duncanmmacleod avatar Jun 04 '20 21:06 duncanmmacleod

See #4731

onomatopellan avatar Jun 04 '20 21:06 onomatopellan

Ok, looks like this is a duplicate of #4731, is that what you mean @onomatopellan?

duncanmmacleod avatar Jun 04 '20 21:06 duncanmmacleod

Hard to say. There are more threads with "Network is unreachable" where people tries to solving it in different ways like in https://github.com/microsoft/WSL/issues/4275#issuecomment-511578223

It depends of your networking configuration, if you are using some VPN, proxy configuration... Try any of the solutions of those threads and if nothing work the best you can do is post a link to a networking trace so the team can take a look at it.

onomatopellan avatar Jun 04 '20 21:06 onomatopellan

Thanks @onomatopellan, I don't have any special networking configuration, so will post a tracr using the feedback hub.

duncanmmacleod avatar Jun 04 '20 21:06 duncanmmacleod

Try any of the solutions of those threads and if nothing work the best you can do is post a link to a networking trace so the team can take a look at it.

I’ve shared my network trace: https://aka.ms/AA8mo2v

WSL1 works fine, WSL2 does not. Downgrading from WSL2 to WSL1 restores connectivity.

wi-ry avatar Jun 09 '20 03:06 wi-ry

Maybe related to https://github.com/microsoft/WSL/issues/5286 ?

ericct avatar Jun 09 '20 08:06 ericct

Try any of the solutions of those threads and if nothing work the best you can do is post a link to a networking trace so the team can take a look at it.

https://aka.ms/AA8mo2v

@MrAusnadian, 'my account doesn't have access to that feedback', can you please summarise the content of that link?

duncanmmacleod avatar Jun 09 '20 09:06 duncanmmacleod

I disabled the Hyper-v feature. The network backs to normal.

yooceii avatar Jun 10 '20 00:06 yooceii

I disabled the Hyper-v feature. The network backs to normal.

How did you do it? If I disable it in windows features then wsl just doesn't run "The request is not supported".

habamax avatar Jun 10 '20 12:06 habamax

@habamax commented on Jun 10, 2020, 7:38 PM GMT+7:

I disabled the Hyper-v feature. The network backs to normal.

How did you do it? If I disable it in windows features then wsl just doesn't run "The request is not supported".

Convert the linux to WSL 1.

rescenic avatar Jun 10 '20 14:06 rescenic

@habamax commented on Jun 10, 2020, 7:38 PM GMT+7:

I disabled the Hyper-v feature. The network backs to normal.

How did you do it? If I disable it in windows features then wsl just doesn't run "The request is not supported".

Convert the linux to WSL 1.

How does it solve the issue with wsl2?

PS, wanted to use wsl2 but it is not ready.

habamax avatar Jun 10 '20 15:06 habamax

@habamax commented on Jun 10, 2020, 7:38 PM GMT+7:

I disabled the Hyper-v feature. The network backs to normal.

How did you do it? If I disable it in windows features then wsl just doesn't run "The request is not supported".

Convert the linux to WSL 1.

How does it solve the issue with wsl2?

PS, wanted to use wsl2 but it is not ready.

You need to ensure the virtual machine platform is enabled, Check the #4840 Also, make sure the folder of the distro is not compressed or encrypted.

yooceii avatar Jun 10 '20 16:06 yooceii

You need to ensure the virtual machine platform is enabled, Check the #4840 Also, make sure the folder of the distro is not compressed or encrypted.

Well, I can start wsl2 but again there is no internet connection while wsl1 has it.

Anyway, thanks, will continue using wsl1.

habamax avatar Jun 10 '20 17:06 habamax

@duncanmmacleod Did you ever solve this? I'm experiencing the same exact issue on 19041.329. I hardly consider using WSL 1 a reasonable solution.

I'm also finding that setting the name server and adding generateResolvConf = false to /etc/wsl.conf has no effect - it gets regenerated after every restart.

archonic avatar Jun 15 '20 17:06 archonic

@duncanmmacleod Did you ever solve this? I'm experiencing the same exact issue on 19041.329. I hardly consider using WSL 1 a reasonable solution.

No, I submitted the relevant feedback reports to Microsoft and am waiting for a response.

duncanmmacleod avatar Jun 15 '20 17:06 duncanmmacleod

I've given up on WSL completely. WSL 2 has network adaptor issues and WSL 1 has no docker integration. It's amazing that despite having a fully dockerized environment, I cannot work on Windows.

archonic avatar Jun 15 '20 18:06 archonic