WSL2无法ping通本地主机ip的解决办法

刚装完WSL2的Ubuntu子系统时,可能无法ping通本地主机的ip:

WSL2系统ip:

本地主机ip:

在powershell里输入如下的命令:

bash 复制代码
New-NetFirewallRule -DisplayName "WSL" -Direction Inbound  -InterfaceAlias "vEthernet (WSL (Hyper-V firewall))"  -Action Allow

然后输入:

bash 复制代码
wsl --shutdown

结果如下:

ping通了,完美解决!!!

相关推荐
Better Bench6 小时前
WSL2 Ubuntu 中 Claude CLI “command not found” 故障排查与修复
linux·ubuntu·claude·wsl·claudecode
LSG_Dawn18 小时前
XBOX360 kinect + ROS2_humble
ubuntu·深度相机
jing.wang_202519 小时前
NVIDIA CUDA C++编程环境搭建--Windows + Ubuntu 22.04
c++·windows·ubuntu·gpu算力
黑白园1 天前
个人台式机VMware 15及Ubuntu 16.04.5卸载以及VMware 16.2.3及Ubuntu 24.04.4安装
linux·ubuntu
想你依然心痛2 天前
从监控数据到告警管理:Prometheus与Alertmanager部署实战
ubuntu·prometheus·内网穿透·系统监控·cpolar·告警管理
黑白园2 天前
解决服务器拒绝连接导致ubuntu镜像无法下载问题 https://mirrors.tuna.tsinghua.edu.cn/ubuntu-releases/
ubuntu
yangpan0112 天前
ubuntu输入法安装及选择
linux·运维·ubuntu
强里秋千墙外道2 天前
Ubuntu 开机 Kernel Panic:HWE 内核升级失败 + NVIDIA DKMS 踩坑实录
linux·运维·ubuntu
啊啊啊迈 旋棍3 天前
【译】TypeScript 7 测试版已在 Visual Studio 2026 18.6 Insiders 3 中默认启用
ubuntu·typescript·visual studio
Eloudy3 天前
ubuntu 22.04安装 cuda 12.8.2
linux·运维·ubuntu