Open duncanmmacleod opened 4 years ago
Try network reset or allow in firewall.
Can you be any more specific about how to do either of those things? I'm new to Windows (just migrating back from macOS).
Try something like ping 216.58.192.164
. Does it work?
$ ping 216.58.192.164
connect: Network is unreachable
See #4731
Ok, looks like this is a duplicate of #4731, is that what you mean @onomatopellan?
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.
Thanks @onomatopellan, I don't have any special networking configuration, so will post a tracr using the feedback hub.
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.
Maybe related to https://github.com/microsoft/WSL/issues/5286 ?
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.
@MrAusnadian, 'my account doesn't have access to that feedback', can you please summarise the content of that link?
I disabled the Hyper-v feature. The network backs to normal.
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 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.
@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 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.
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.
@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.
@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.
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.
In my case it was the firewall of my antivirus suite that is blocking the connection. Try disabling your antivirus' firewall (or the whole suite) and retry the connection.
The bridge network via your primary physical connection that provides external network access to the WSL guest should work out of the box.
On my case it is norton's firewall that is blocking the connection. It is quite hard to see since there are no notifications that the connection is being blocked. I just added at WSL guest hardware / MAC address via the device trust list.
Similar issue here: after upgrade to ver 2004 and wsl 2 - internet (or network) non-functional in any distro.
My network config is very simple : plain GB ethernet and (disabled) wi-fi; no any 3rd party network or "security" stuff.
@pavel-a
=============================================================================
FIX WSL2 NETWORKING IN WINDOWS 10
=============================================================================
cmd as admin:
wsl --shutdown
netsh winsock reset
netsh int ip reset all
netsh winhttp reset proxy
ipconfig /flushdns
Windows Search > Network Reset
Restart Windows
-----------------------------------------------------------------------------
OR
# Fix network issues
# Delete auto-generated files
[root@PC-NAME user]# rm /etc/resolv.conf || true
[root@PC-NAME user]# rm /etc/wsl.conf || true
# Enable changing /etc/resolv.conf
# Enable extended attributes on Windows drives
[root@PC-NAME user]# cat <<EOF > /etc/wsl.conf
[network]
generateResolvConf = false
[automount]
enabled = true
options = "metadata"
mountFsTab = false
EOF
# Use google nameservers for DNS resolution
[root@PC-NAME user]# cat <<EOF > /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
EOF
Exit Linux WSL
cmd as admin:
wsl --shutdown
netsh winsock reset
netsh int ip reset all
netsh winhttp reset proxy
ipconfig /flushdns
Windows Search > Network Reset
Restart Windows
@pavel-a
============================================================================= FIX WSL2 NETWORKING IN WINDOWS 10 ============================================================================= cmd as admin: wsl --shutdown netsh winsock reset netsh int ip reset all netsh winhttp reset proxy ipconfig /flushdns Windows Search > Network Reset Restart Windows -----------------------------------------------------------------------------
OR
# Fix network issues # Delete auto-generated files [root@PC-NAME user]# rm /etc/resolv.conf || true [root@PC-NAME user]# rm /etc/wsl.conf || true # Enable changing /etc/resolv.conf # Enable extended attributes on Windows drives [root@PC-NAME user]# cat <<EOF > /etc/wsl.conf [network] generateResolvConf = false [automount] enabled = true options = "metadata" mountFsTab = false EOF # Use google nameservers for DNS resolution [root@PC-NAME user]# cat <<EOF > /etc/resolv.conf nameserver 8.8.8.8 nameserver 8.8.4.4 EOF Exit Linux WSL cmd as admin: wsl --shutdown netsh winsock reset netsh int ip reset all netsh winhttp reset proxy ipconfig /flushdns Windows Search > Network Reset Restart Windows
Tried, did not work.. when i use ifconfig eth0 there is no ipv4
Hey all,
Please try this if wsl2's internet stops working
/etc/resolv.conf
nameserver 17...
nameserver 8.8.8.8
sudo nano /etc/wsl.conf
[network]
generateResolvConf = false
The solution by above by Ziauddin02 resolves it in script form :)
Hey all,
Please try this if wsl2's internet stops working
- sudo nano
/etc/resolv.conf
- Comment out the nameserver
#nameserver 17...
- add this new line
nameserver 8.8.8.8
- ctrl + o and ctrl + x to write a quit
- hopefully the issue is fixed :)
Worked! also swapping out 8.8.8.8 to any other (eligible?) DNS seems to work. Though, if I have set my Windows to use a different one, would it cause any problems?
Hey all, Please try this if wsl2's internet stops working
- sudo nano
/etc/resolv.conf
- Comment out the nameserver
#nameserver 17...
- add this new line
nameserver 8.8.8.8
- ctrl + o and ctrl + x to write a quit
- hopefully the issue is fixed :)
Worked! also swapping out 8.8.8.8 to any other (eligible?) DNS seems to work. Though, if I have set my Windows to use a different one, would it cause any problems?
Sorry, I have updated my solution, you can tell wsl to stop updating that file, which will fix that issue :), also the answer to your question is yes, any eligible DNS should work perfectly :)
A tip that may work in your case if you have wsl2 not working properly, while wsl1 has network and proper VPN access:
Note: It seems to me that the problem is that wsl2 is not generating propertly the resolv.conf.
@pavel-a
============================================================================= FIX WSL2 NETWORKING IN WINDOWS 10 ============================================================================= cmd as admin: wsl --shutdown netsh winsock reset netsh int ip reset all netsh winhttp reset proxy ipconfig /flushdns Windows Search > Network Reset Restart Windows -----------------------------------------------------------------------------
OR
# Fix network issues # Delete auto-generated files [root@PC-NAME user]# rm /etc/resolv.conf || true [root@PC-NAME user]# rm /etc/wsl.conf || true # Enable changing /etc/resolv.conf # Enable extended attributes on Windows drives [root@PC-NAME user]# cat <<EOF > /etc/wsl.conf [network] generateResolvConf = false [automount] enabled = true options = "metadata" mountFsTab = false EOF # Use google nameservers for DNS resolution [root@PC-NAME user]# cat <<EOF > /etc/resolv.conf nameserver 8.8.8.8 nameserver 8.8.4.4 EOF Exit Linux WSL cmd as admin: wsl --shutdown netsh winsock reset netsh int ip reset all netsh winhttp reset proxy ipconfig /flushdns Windows Search > Network Reset Restart Windows
First option worked perfect for me
@duncanmmacleod Since your ifconfig eth0
didn't show any IP your issue could be #5437. Because of a bug there is no network initialization in WSL2 if swap file can't be created.
So try disabling swap file like suggested in that thread and you should get network connection in WSL2.
@duncanmmacleod Since your
ifconfig eth0
didn't show any IP your issue could be #5437. Because of a bug there is no network initialization in WSL2 if swap file can't be created. So try disabling swap file like suggested in that thread and you should get network connection in WSL2.
@onomatopellan, YES! If I follow the disable swap instructions here, then restart WSL, I have network!
Thank you!
I just set up WSL 2 on a fresh installation of Windows on a brand new drive. I can't install anything with apt
because the network is unreachable. It's ridiculous that such basic stuff is broken with default settings. I don't want to waste my time trying every possible fix on StackOverflow and GitHub, the Microsoft setup guide should work.
Yeah, I upgraded to wsl2 from wsl1, it was fine. Upgraded win10 to 2004, then the nameresolver ip in /etc/resolv.conf was no longer reachable somehow. This looks to be the IP of the hyper-v bridge (172...) -- I changed the resolver to my router's IP and it was fine again. Definitely something b0rked.
ping: google.com: Temporary failure in name resolution
Of course, restarting the lightweight vm caused resolv.conf to be regenerated and it is again broken. I'll try updating /etc/wsl.conf to stop that.
setting /etc/wsl.conf
to:
[network]
generateResolvConf = false
has no effect, even after restarting the lightweight vm (rebooting host/w10)
What's going on? It keeps regenerating it and points to the hyper-v bridge, which is not responding to DNS requests. Even when my windows 10 firewall is entirely disabled.
No network connection after network reset and manual edition of resolv.conf. Manipulations with resolve.conf can't help if any dns is unreachable. Windows network troubleshooting reports WSL switch error - incorrect IP but can't resolve it. It says that something is wrong with WSL network cables. I suppose that WiFi adapter is not shared correctly between Windows and Linux. My WiFi adapter is recognized as a public network adapter, True? I.e. can't be shared with the bridged guest VM. WSL switch properties can't be modified using Virtual switch manager now and manual creation of WSL external network switch results in error "The network was not found." It looks like a bug in WSL switch creation or sharing center gap. Maybe WSL adapter has to be bridged with WiFi adapter anyway ????????????????????????????? But stupid Windows 10 Network and sharing center doesn't show this option.
Is it WSL issue at all ???????????? I use Norton antivirus with Norton 360, My Norton, Norton firewall, and all its gadgets. Only when I disabled Norton "smart" firewall completely WSL networking started to work. Unfortunately, every Norton's UI has its independent "Settings". I didn't find any Norton API and when I tried to config security via Windows firewall I got the message that it uses Norton as the provider and it does nothing. Thanks to Norton!
So, I can confirm a workaround found somewhere else. If I start a WSL2 instance after I start my work (Cisco AnyConnect) VPN, networking inside the WSL2 instance doesn't work at all. Can't ping the gateway, etc.
If you start the WSL2 before you connect the VPN, WSL2 networking works. If you then connect the VPN, WSL2 networking continues to work.
@pavel-a
============================================================================= FIX WSL2 NETWORKING IN WINDOWS 10 ============================================================================= cmd as admin: wsl --shutdown netsh winsock reset netsh int ip reset all netsh winhttp reset proxy ipconfig /flushdns Windows Search > Network Reset Restart Windows -----------------------------------------------------------------------------
OR
# Fix network issues # Delete auto-generated files [root@PC-NAME user]# rm /etc/resolv.conf || true [root@PC-NAME user]# rm /etc/wsl.conf || true # Enable changing /etc/resolv.conf # Enable extended attributes on Windows drives [root@PC-NAME user]# cat <<EOF > /etc/wsl.conf [network] generateResolvConf = false [automount] enabled = true options = "metadata" mountFsTab = false EOF # Use google nameservers for DNS resolution [root@PC-NAME user]# cat <<EOF > /etc/resolv.conf nameserver 8.8.8.8 nameserver 8.8.4.4 EOF Exit Linux WSL cmd as admin: wsl --shutdown netsh winsock reset netsh int ip reset all netsh winhttp reset proxy ipconfig /flushdns Windows Search > Network Reset Restart Windows
Definitely worked for me!!
@pavel-a
============================================================================= FIX WSL2 NETWORKING IN WINDOWS 10 ============================================================================= cmd as admin: wsl --shutdown netsh winsock reset netsh int ip reset all netsh winhttp reset proxy ipconfig /flushdns Windows Search > Network Reset Restart Windows -----------------------------------------------------------------------------
OR
# Fix network issues # Delete auto-generated files [root@PC-NAME user]# rm /etc/resolv.conf || true [root@PC-NAME user]# rm /etc/wsl.conf || true # Enable changing /etc/resolv.conf # Enable extended attributes on Windows drives [root@PC-NAME user]# cat <<EOF > /etc/wsl.conf [network] generateResolvConf = false [automount] enabled = true options = "metadata" mountFsTab = false EOF # Use google nameservers for DNS resolution [root@PC-NAME user]# cat <<EOF > /etc/resolv.conf nameserver 8.8.8.8 nameserver 8.8.4.4 EOF Exit Linux WSL cmd as admin: wsl --shutdown netsh winsock reset netsh int ip reset all netsh winhttp reset proxy ipconfig /flushdns Windows Search > Network Reset Restart Windows
I tried the first option and it worked for me! Thx!
The first option from @rescenic worked for me, although actually I skipped the Windows Network Reset step and it still worked. Thanks for the advice!
The first option from @rescenic worked for me, although actually I skipped the Windows Network Reset step and it still worked. Thanks for the advice!
@tomparkinson Can you point out to exactly what you did? Isn't working for me again.
@inthevortex I used the first option that @rescenic posted in this comment which was:
cmd as admin: wsl --shutdown netsh winsock reset netsh int ip reset all netsh winhttp reset proxy ipconfig /flushdns
Windows Search > Network Reset (I actually skipped this part)
Restart Windows
@inthevortex I used the first option that @rescenic posted in this comment which was:
cmd as admin: wsl --shutdown netsh winsock reset netsh int ip reset all netsh winhttp reset proxy ipconfig /flushdns Windows Search > Network Reset (I actually skipped this part) Restart Windows
@tomparkinson I tried doing that without the second last line and the restart, but it's the same for me...
@rescenic 's method worked for me, everything, including apt and x-server, works again. Thanks!
@inthevortex I used the first option that @rescenic posted in this comment which was:
cmd as admin: wsl --shutdown netsh winsock reset netsh int ip reset all netsh winhttp reset proxy ipconfig /flushdns Windows Search > Network Reset (I actually skipped this part) Restart Windows
@tomparkinson I tried doing that without the second last line and the restart, but it's the same for me...
I think the restart is required - I seem to remember that the output from one or more of the netsh commands said that it would not take effect until after a restart.
@inthevortex I used the first option that @rescenic posted in this comment which was:
cmd as admin: wsl --shutdown netsh winsock reset netsh int ip reset all netsh winhttp reset proxy ipconfig /flushdns Windows Search > Network Reset (I actually skipped this part) Restart Windows
@tomparkinson I tried doing that without the second last line and the restart, but it's the same for me...
I think the restart is required - I seem to remember that the output from one or more of the netsh commands said that it would not take effect until after a restart.
@tomparkinson restart made it work again, but let's see if it persists. :P
Awesome, yesterday it worked, now it is all broken again...
Awesome, yesterday it worked, now it is all broken again...
Yes, for me it worked after restart but then I put my laptop to sleep, after that it stopped working.
Also find myself in this position - I'll try the procedure outlined above and report back later - can't reboot until later today. This worked fine when I first upgraded to WSL2, but it's broken now.
So, I can confirm a workaround found somewhere else. If I start a WSL2 instance after I start my work (Cisco AnyConnect) VPN, networking inside the WSL2 instance doesn't work at all. Can't ping the gateway, etc.
If you start the WSL2 before you connect the VPN, WSL2 networking works. If you then connect the VPN, WSL2 networking continues to work.
This was also my problem.
Environment
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.
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...)