默认情况下Windows上可以访问到WSL2里启动的服务。
而反过来,wsl2访问windows上启动的服务报 Connection refused
经搜索, Windows 的本地 ip 映射成了 nameserver ,要通过nameserver的ip访问
grep -m 1 nameserver /etc/resolv.conf | awk '{print $2}'
We can use this IP to access windows localhost.
参考: https://devdojo.com/mvnarendrareddy/access-windows-localhost-from-wsl2