Java OpenResty Spring Spring Boot MySQL Redis MongoDB PostgreSQL Linux Android Nginx 面试 小程序 Arthas JVM AQS juc Kubernetes Docker 诊断工具


Windows WSL 能 ping 通但 curl 无响应

WSL Windows 大约 640 字

可能的解决方法

方法一:WSL子系统中执行:

sudo rm /etc/resolv.conf
sudo bash -c 'echo "nameserver 8.8.8.8" > /etc/resolv.conf'
sudo bash -c 'echo "[network]" > /etc/wsl.conf'
sudo bash -c 'echo "generateResolvConf = false" >> /etc/wsl.conf'
sudo chattr +i /etc/resolv.conf

方法二:Windows中执行

wsl --shutdown
netsh winsock reset
netsh int ip reset all
netsh winhttp reset proxy
ipconfig /flushdns

方法三:退回到WSL1版本(WSL1WSL2的网络模式不同,/etc/resolv.conf文件内容也不同)

wsl --set-version Ubuntu-20.04 1

无解的场景

如果使用的是WSL2版本,且安装了Symantec Endpoint Protection赛门铁克等安全软件,会拦截wsl.exe流量。如果无法关闭这类软件,则只能考虑使用Virutal BoxVMWare等虚拟机了。

参考地址

https://github.com/microsoft/WSL/issues/5382

阅读 3465 · 发布于 2022-07-01

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb

扫描下方二维码关注公众号和小程序↓↓↓

扫描二维码关注我
昵称:
随便看看 换一批