Windows 主机的VMware 虚拟机访问 wsl-ubuntu 的 API 服务

Windows 主机的VMware 虚拟机访问 wsl-ubuntu 的 API 服务

0. 背景

需要从Windows 主机的VMware 虚拟机访问 wsl-ubuntu 的 API 服务。

1. 设置

Windows 主机的IP:192.168.31.20
wsl-ubuntu Ubuntu-22.04 的IP:172.29.211.52 (通过 wsl -d Ubuntu-22.04 ip addr show eth0 确认)

netsh interface portproxy add v4tov4 listenport=8000 listenaddress=192.168.31.20 connectport=8000 connectaddress=172.29.211.52

确认,

netsh interface portproxy show v4tov4

2. 删除

netsh interface portproxy delete v4tov4 listenport=8000 listenaddress=172.29.211.52

完结!

猜你喜欢

转载自blog.csdn.net/engchina/article/details/132114360
今日推荐