1. 添加防火墙入站规则
在powershell中以管理员权限输入以下命令
New-NetFirewallRule -DisplayName "WSL" -Direction Inbound -InterfaceAlias "vEthernet (WSL)" -Action Allow
2. 修改DNS
再 sudo vim /etc/resolv.conf,添加nameserver 8.8.8.8
但每次重启文件就自动还原了
参考文章
https://blog.youkuaiyun.com/Cypher_X/article/details/123011200
https://blog.youkuaiyun.com/makarov5/article/details/122493701