wsl2 Network is unreachable
Windows Version
Microsoft Windows [Version 10.0.22621.3527]
WSL Version
2.2.4.0
Are you using WSL 1 or WSL 2?
- [x] WSL 2
- [ ] WSL 1
Kernel Version
5.15.153.1
Distro Version
Debian 12
Other Software
No response
Repro Steps
root@debian-wsl:/mnt/c/Users/randomtree#ping 172.16.100.254 # my gateway ip
root@debian-wsl:/mnt/c/Users/randomtree#ping: connect: Network is unreachable
root@debian-wsl:/mnt/c/Users/randomtree#ping www.google.com
root@debian-wsl:/mnt/c/Users/randomtree#ping: www.google.com: Name or service not known
root@debian-wsl:/mnt/c/Users/randomtree# wget -x www.baidu.com --2024-11-22 19:57:32-- http://www.baidu.com/ Resolving www.baidu.com (www.baidu.com)... failed: Name or service not known. wget: unable to resolve host address ‘www.baidu.com’
Expected Behavior
can touch the lan and internet
Actual Behavior
no network
Diagnostic Logs
Logs are required for review from WSL team
If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'. Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.
How to collect WSL logs
Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:
Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1
The script will output the path of the log file once done.
If this is a networking issue, please use collect-networking-logs.ps1, following the instructions here
Once completed please upload the output files to this Github issue.
Click here for more info on logging If you choose to email these logs instead of attaching to the bug, please send them to [email protected] with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.
View similar issues
Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it!
Open similar issues:
- No network connection in any distribution under WSL2 (#11131), similarity score: 0.77
- no network/internet access (#11675), similarity score: 0.77
- Cannot ping WSL network interface (#11264), similarity score: 0.74
Closed similar issues:
- Network is unreachable on ethernet connection but Ping, Traceroute work on Debian wsl2 on windows11 version 23H2 (#10744), similarity score: 0.77
- WSL2 can't ping any ip address , and all Network status is DOWN (#7356), similarity score: 0.76
Note: You can give me feedback by thumbs upping or thumbs downing this comment.
Diagnostic information
.wslconfig found
Failed to parse .wslconfig: doesn't support inline comment[wsl2]
# networkingMode=bridged # 桥接模式
# vmSwitch=gpu # 你想使用的网卡
# ipv6=true # 启用 IPv6
[experimental]
# 实验性自动内存回收(可选值 gradual、dropcache 和 disabled)
autoMemoryReclaim=dropcache
# 实验性稀疏 VHD
sparseVhd=true
#****************************** 实验性网络相关 ********************************#
# 实验性网络镜像模式 (可选值 mirrored 和 virtioproxy nat )
networkingMode=mirrored
# 实验性 DNS 隧道
dnsTunneling=true
firewall=true # 实验性防火墙
# 实验性自动代理
autoProxy=true
# 实验性使用 Windows DNS 缓存
useWindowsDnsCache=true
# 实验性尽力 DNS 解析
bestEffortDnsParsing=true
# 实验性初始自动代理超时
# initialAutoProxyTimeout=60
# 未知,待测试
# ignoredPorts
# 未知,待测试
hostAddressLoopback=true
Detected appx version: 2.2.4.0
optional-components.txt not found
Diagnostic information
Issue was edited and new log file was found: https://github.com/user-attachments/files/17869925/WslNetworkingLogs-2024-11-22_20-13-47.zip
.wslconfig found
Failed to parse .wslconfig: doesn't support inline comment[wsl2]
# networkingMode=bridged # 桥接模式
# vmSwitch=gpu # 你想使用的网卡
# ipv6=true # 启用 IPv6
[experimental]
# 实验性自动内存回收(可选值 gradual、dropcache 和 disabled)
autoMemoryReclaim=dropcache
# 实验性稀疏 VHD
sparseVhd=true
#****************************** 实验性网络相关 ********************************#
# 实验性网络镜像模式 (可选值 mirrored 和 virtioproxy nat )
networkingMode=mirrored
# 实验性 DNS 隧道
dnsTunneling=true
firewall=true # 实验性防火墙
# 实验性自动代理
autoProxy=true
# 实验性使用 Windows DNS 缓存
useWindowsDnsCache=true
# 实验性尽力 DNS 解析
bestEffortDnsParsing=true
# 实验性初始自动代理超时
# initialAutoProxyTimeout=60
# 未知,待测试
# ignoredPorts
# 未知,待测试
hostAddressLoopback=true
Detected appx version: 2.2.4.0
optional-components.txt not found
View similar issues
Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it!
Open similar issues:
- no network/internet access (#11675), similarity score: 0.77
- No network connection in any distribution under WSL2 (#11131), similarity score: 0.77
- Cannot ping WSL network interface (#11264), similarity score: 0.75
Closed similar issues:
- Network is unreachable on ethernet connection but Ping, Traceroute work on Debian wsl2 on windows11 version 23H2 (#10744), similarity score: 0.80
- WSL2 can't ping any ip address , and all Network status is DOWN (#7356), similarity score: 0.76
Note: You can give me feedback by thumbs upping or thumbs downing this comment.
Diagnostic information
.wslconfig found
Failed to parse .wslconfig: doesn't support inline comment[wsl2]
# networkingMode=bridged # 桥接模式
# vmSwitch=gpu # 你想使用的网卡
# ipv6=true # 启用 IPv6
[experimental]
# 实验性自动内存回收(可选值 gradual、dropcache 和 disabled)
autoMemoryReclaim=dropcache
# 实验性稀疏 VHD
sparseVhd=true
#****************************** 实验性网络相关 ********************************#
# 实验性网络镜像模式 (可选值 mirrored 和 virtioproxy nat )
networkingMode=mirrored
# 实验性 DNS 隧道
dnsTunneling=true
firewall=true # 实验性防火墙
# 实验性自动代理
autoProxy=true
# 实验性使用 Windows DNS 缓存
useWindowsDnsCache=true
# 实验性尽力 DNS 解析
bestEffortDnsParsing=true
# 实验性初始自动代理超时
# initialAutoProxyTimeout=60
# 未知,待测试
# ignoredPorts
# 未知,待测试
hostAddressLoopback=true
Detected appx version: 2.2.4.0
optional-components.txt not found
Diagnostic information
Issue was edited and new log file was found: https://github.com/user-attachments/files/17869957/WslNetworkingLogs-2024-11-22_20-16-32.zip
.wslconfig found
Failed to parse .wslconfig: doesn't support inline comment[wsl2]
# networkingMode=bridged # 桥接模式
# vmSwitch=gpu # 你想使用的网卡
# ipv6=true # 启用 IPv6
[experimental]
# 实验性自动内存回收(可选值 gradual、dropcache 和 disabled)
autoMemoryReclaim=dropcache
# 实验性稀疏 VHD
sparseVhd=true
#****************************** 实验性网络相关 ********************************#
# 实验性网络镜像模式 (可选值 mirrored 和 virtioproxy nat )
networkingMode=mirrored
# 实验性 DNS 隧道
dnsTunneling=true
firewall=true # 实验性防火墙
# 实验性自动代理
autoProxy=true
# 实验性使用 Windows DNS 缓存
useWindowsDnsCache=true
# 实验性尽力 DNS 解析
bestEffortDnsParsing=true
# 实验性初始自动代理超时
# initialAutoProxyTimeout=60
# 未知,待测试
# ignoredPorts
# 未知,待测试
hostAddressLoopback=true
Detected appx version: 2.2.4.0
optional-components.txt not found
dmesg show:
[ 92.107340] hv_vmbus: probe failed for device 02c52ad9-d069-4f46-873b-f449dca960ec (-19) [ 92.229247] hv_netvsc 02c52ad9-d069-4f46-873b-f449dca960ec (unnamed net_device) (uninitialized): unable to open channel: -19 [ 92.230343] hv_netvsc 02c52ad9-d069-4f46-873b-f449dca960ec (unnamed net_device) (uninitialized): unable to add netvsc device (ret -19) [ 92.231223] hv_vmbus: probe failed for device 02c52ad9-d069-4f46-873b-f449dca960ec (-19) [ 92.352303] hv_netvsc 02c52ad9-d069-4f46-873b-f449dca960ec (unnamed net_device) (uninitialized): unable to open channel: -19 [ 92.353224] hv_netvsc 02c52ad9-d069-4f46-873b-f449dca960ec (unnamed net_device) (uninitialized): unable to add netvsc device (ret -19) [ 92.354132] hv_vmbus: probe failed for device 02c52ad9-d069-4f46-873b-f449dca960ec (-19) [ 92.477967] hv_netvsc 02c52ad9-d069-4f46-873b-f449dca960ec (unnamed net_device) (uninitialized): unable to open channel: -19 [ 92.479011] hv_netvsc 02c52ad9-d069-4f46-873b-f449dca960ec (unnamed net_device) (uninitialized): unable to add netvsc device (ret -19) [ 92.479903] hv_vmbus: probe failed for device 02c52ad9-d069-4f46-873b-f449dca960ec (-19) [ 92.600783] hv_netvsc 02c52ad9-d069-4f46-873b-f449dca960ec (unnamed net_device) (uninitialized): unable to open channel: -19 [ 92.601702] hv_netvsc 02c52ad9-d069-4f46-873b-f449dca960ec (unnamed net_device) (uninitialized): unable to add netvsc device (ret -19) [ 92.602426] hv_vmbus: probe failed for device 02c52ad9-d069-4f46-873b-f449dca960ec (-19) seem like net_device init failed
i changed the networkingMode in .wslconfig, made the value nat, and now the network is working. 😎
it's workin' okay now. Maybe Windows 11's update has changed the mirrored network. I don't wanna spend much more time on it. So, it's done!
The LAN cannot access the network of WSL.
I may have found the problem,but i can't take it over. My computer has two network cards. One is built into the motherboard, and the other is a USB Wi-Fi network card. After a certain system update, the mirrored mode broke down and my motherboard's built-in network card could not be loaded. After I disabled it, WSL could start normally and the network was also normal. If only the motherboard network card is retained and my Wi-Fi network card is disabled, there will still be an error when starting up and there is no network. My motherboard network card is Realtek RTL8168/8111/8112 Gigabit Ethernet Controller/Asrock. The Windows version is Microsoft Windows version 22H2 (OS internal version 22621.3527).
我也许找到了问题,我的电脑有两张网卡,一张是主板自带的,一个是usb wifi 网卡,某次系统以后,mirrored模式就坏了,无法加载我的主板自带的网卡,我把他停用以后,wsl就可以正常启动,网络也是正常的。如果只保留主板网卡,停用我的wifi网卡,启动还是报错,没有网络。 我的主板网卡是 瑞昱RTL8168/8111/8112 Gigabit Ethernet Controller/华擎,window版本是Microsoft Windows版本22H2(0S内部版22621.3527)
The logs show that mirrored networking is in use:
22010 False Microsoft.Windows.Lxss.Manager GuestLog 0 11/22/2024 04:16:53.893 " " "text: ""SecCompDispatcher: Notified for arch C000003E syscall 49 with id 7556123691645761690 for pid 218 with args (9, 7FFD2B938E60, 10, 0, 0, 0) ""
vmId: {637cf6c9-5bef-4605-bd08-f16647491ff4}" 8576 29528 5 00000000-0000-0000-0000-000000000000
@CatalinFetoiu can you take a look?
@lifetraveler thanks for reporting the issue from the logs in your initial comment, I see generateResolvConf is set to false in your /etc/wsl.conf, while dnsTunneling is set to true in wslconfig. generateResolvConf needs to be true (or default, which is also true), in order for dnsTunneling to be successfully enabled
can you please try setting setting generateResolvConf to true, then run "wsl --shutdown" and restart WSL? let us know if you still encounter DNS issues after doing this
@CatalinFetoiu
@lifetraveler thanks for reporting the issue from the logs in your initial comment, I see generateResolvConf is set to false in your /etc/wsl.conf, while dnsTunneling is set to true in wslconfig. generateResolvConf needs to be true (or default, which is also true), in order for dnsTunneling to be successfully enabled
can you please try setting setting generateResolvConf to true, then run "wsl --shutdown" and restart WSL? let us know if you still encounter DNS issues after doing this
WslLogs-2024-11-27_14-38-14.zip WslNetworkingLogs-2024-11-27_14-33-29.zip
my wsl.conf
root@debian-wsl:/mnt/c/Users/randomtree# cat /etc/wsl.conf
[boot]
systemd=true
[network]
hostname = debian-wsl
generateHosts = false
generateResolvConf = true
Diagnostic information
Multiple log files found, using: https://github.com/user-attachments/files/17930113/WslLogs-2024-11-27_14-38-14.zip
.wslconfig found
Detected appx version: 2.3.26.0
I bumped into this while searching for unable to add netvsc device (ret -19) on this repo, since I saw this error on my journalctl --boot.
Before an update I only had this issue when I have LAN cable connected through docking station, and worked around it by directly connecting to the laptop. Now both of them don't work.
Everytime I plug the ethernet cable in to/out of the docking station journalctl spams WSL (250) ERROR: CheckConnection: getaddrinfo() failed: -5.