Repository navigation
Closed
Labels
Description
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.1Gist 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...)
Reacted by Maxim Kim, Archonic, Paris Qian, kumarvaradarajulu, Marat Saidov, Formica, A. Cingoranelli, CCXXXI, Jiri Dubansky, PavelSosin-320 and 205 more
Reacted by Tim Schwenke and Jaime Moncayo
Reacted by Tim Schwenke and Jaime Moncayo
Reacted by Tim Schwenke and Jaime Moncayo
Reacted by Tim Schwenke, Jaime Moncayo, Fabio Souza and Harshit Pant
Reacted by Tim Schwenke, Joseph Izang, Jaime Moncayo, keniti213, Harshit Pant and Adrian Henle
Reacted by Tim Schwenke and Jaime Moncayo
Reacted by Maxim Kim, Formica, Hitesh Dhola, Andrew Spear, Anis Mula, Tim Schwenke, Sascha Elble, Eric Villarreal, Esteban Escobar, ws1990 and 5 more
Activity
rescenic commentedon Jun 4, 2020
Try network reset or allow in firewall.
duncanmmacleod commentedon Jun 4, 2020
Can you be any more specific about how to do either of those things? I'm new to Windows (just migrating back from macOS).
onomatopellan commentedon Jun 4, 2020
Try something like
ping 216.58.192.164. Does it work?duncanmmacleod commentedon Jun 4, 2020
onomatopellan commentedon Jun 4, 2020
See #4731
duncanmmacleod commentedon Jun 4, 2020
Ok, looks like this is a duplicate of #4731, is that what you mean Jonathan (@onomatopellan)?
onomatopellan commentedon Jun 4, 2020
Hard to say. There are more threads with "Network is unreachable" where people tries to solving it in different ways like in #4275 (comment)
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.
duncanmmacleod commentedon Jun 4, 2020
Thanks Jonathan (@onomatopellan), I don't have any special networking configuration, so will post a tracr using the feedback hub.
wi-ry commentedon Jun 9, 2020
I’ve shared my network trace: https://aka.ms/AA8mo2v
WSL1 works fine, WSL2 does not. Downgrading from WSL2 to WSL1 restores connectivity.
ericct commentedon Jun 9, 2020
Maybe related to #5286 ?
duncanmmacleod commentedon Jun 9, 2020
mrausnadian, 'my account doesn't have access to that feedback', can you please summarise the content of that link?
yooceii commentedon Jun 10, 2020
I disabled the Hyper-v feature. The network backs to normal.
habamax commentedon Jun 10, 2020
How did you do it? If I disable it in windows features then wsl just doesn't run "The request is not supported".
rescenic commentedon Jun 10, 2020
@habamax commented on Jun 10, 2020, 7:38 PM GMT+7:
Convert the linux to WSL 1.
habamax commentedon Jun 10, 2020
How does it solve the issue with wsl2?
PS, wanted to use wsl2 but it is not ready.
199 remaining items
jby commentedon Nov 24, 2023
How did this turn into an issue about DNS?
I have the same problem as Duncan Macleod (@duncanmmacleod) in the original post.
Windows 10, WSL1, Ubuntu -> works fine
Convert to WSL2 -> No network traffic leaving the Ubuntu install, I don't even get a ping response from the Windows host - the Windows host can ping the WSL2 Ubuntu install though.
jby commentedon Nov 24, 2023
The reported failures in DNS resolution is a result of the problem - not the cause...
Elektronenvolt commentedon Dec 3, 2023
Can confirm this statement. In our case Windows Defender blocked incoming DNS for the WSL network adapter. In other cases here VPN clients caused DNS troubles, e.g.
jansturm1 commentedon Apr 4, 2024
Only solution that worked for me (https://superuser.com/a/1671057/1662386):
Add the following to your <windows_user_profile>/.wslconfig:
Run wsl --shutdown from PowerShell then restart WSL
Kieran-Sears commentedon Apr 15, 2024
I believe you need to include
[network]above it, just havinggenerateResolvConf = falsedoesn't cut it.zeroarst commentedon May 21, 2024
I got
Any idea?
keith-horton commentedon May 21, 2024
Mirrored Mode requires Windows 11 22H2 and higher. And the optional component "Virtual Machine Platform" is installed.
Thanks!
InternetPseudonym commentedon May 21, 2024
oh, nice ... a version-locked feature and the the version it is locked to just so happens to be the most ad-ridden one of all time. I see the marketing department finally took full control. Well. It really "is" time to switch / virtualize / pirate winblows, then. Who would've thought.
Elektronenvolt commentedon May 21, 2024
Well, I would call it 'dependency' 🧐But, what is 'version locked' in this case? Don't see it...
hub977 commentedon Jul 30, 2024
我参考此链接得以在WSL2下恢复网络 https://learn.microsoft.com/zh-cn/windows/wsl/troubleshooting
1.允许 DNS 数据包共享访问的 HNS 防火墙规则可能无效,引用以前的 WSL 接口标识符。 这是 HNS 中的一处缺陷,在最新的 Windows 11 版本已得到修复。 在早期版本中如果发生这种情况,虽然不容易发现,但有一个简单的解决方法:
2.停止 WSL
wsl.exe –shutdown
3.删除旧的 HNS 防火墙规则。 大多数情况下,此 Powershell 命令应正常工作:
Get-NetFirewallRule -Name "HNS*" | Get-NetFirewallPortFilter | where Protocol -eq UDP | where LocalPort -eq 53 | Remove-NetFirewallRule
4.移除所有 HNS 终结点。 注意:如果使用 HNS 管理其他容器(例如 MDAG 或 Windows 沙盒),则还应停止这些容器。
hnsdiag.exe delete all
5.重新启动或重启 HNS 服务
Restart-Service hns #如果重启hns报错,需要依赖项,可重启电脑解决
6.重启 WSL 后,HNS 将创建新的防火墙规则,并正确面向 WSL 接口。
C:\Users\Administrator>wsl -l -v
NAME STATE VERSION
C:\Users\Administrator>wsl
┏━(Message from Kali developers)
┃
┃ This is a minimal installation of Kali Linux, you likely
┃ want to install supplementary tools. Learn how:
┃ ⇒ https://www.kali.org/docs/troubleshooting/common-minimum-setup/
┃
┗━(Run: “touch ~/.hushlogin” to hide this message)
┌──(root㉿BOT)-[/mnt/c/Users/Administrator]
└─# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=48 time=59.3 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=48 time=64.6 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=48 time=58.2 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=48 time=101 ms
64 bytes from 8.8.8.8: icmp_seq=5 ttl=48 time=61.6 ms
^C
--- 8.8.8.8 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4007ms
rtt min/avg/max/mdev = 58.243/69.056/101.487/16.363 ms
如上ping 8.8.8.8可以通
hub977 commentedon Jul 30, 2024
本人系统环境为windows 10.0.19044
同时需要在 /etc/resolv.conf中写入servername 8.8.8.8
/etc/wsl.conf中写入
[network]
generateResolvConf = false
希望能帮助到你!!!
friedinando commentedon Aug 11, 2024
In my case, this config fix the problem:
[wsl2]
networkingMode=mirrored
Exit your WSL distribution
tannath commentedon Oct 10, 2024
Before use name like eth0 of device with internet access - check device name by:
A working solution on mode bridged
On windows brand new virtual device (enable features of hyper-v in cli):
make by:
And finally firewall, yep firewall ( your $clsid will be different - Name) :
On windows in file at c:/Users/<name_of_user>/.wslconfig
craigloewen-msft commentedon May 27, 2025
I'm closing out old issues. This has been around for a while. If you're still seeing this with the latest version of WSL please open a new issue. Thank you!