Back

WSL Windows IP 互访

其实是为了给 WSL 提供本地代理,方便访问 Golang 和 Github 仓库

WSL2 访问 Windows IP

WSL:

cat /etc/resolv.conf

nameserver 即为可访问的 Windows IP

Windows 开启 WSL2 对 Windows 的访问

添加规则允许 WSL2 通过防火墙。

Powershell:

New-NetFirewallRule -DisplayName "WSL" -Direction Inbound  -InterfaceAlias "vEthernet (WSL)"  -Action Allow

Windows 访问 WSL2 IP

Powershell:

wsl hostname -I

参考

Licensed under CC BY-NC-SA 4.0
comments powered by Disqus
Built with Hugo
Theme Stack designed by Jimmy