1. 在wsl中运行

sudo ip addr del $(ip addr show eth0 | grep 'inet\b' | awk '{print $2}' | head -n 1) dev eth0
sudo ip addr add 192.168.10.100/23 broadcast 192.168.11.255 dev eth0
sudo ip route add 0.0.0.0/0 via 192.168.10.1 dev eth0
sudo systemctl start shh

echo "" > /etc/resolv.conf
echo "nameserver 1.1.1.1" >> /etc/resolv.conf
echo "nameserver 8.8.8.8" >> /etc/resolv.conf

2. 在宿主机powershell中运行

Set-VMSwitch WSL -NetAdapterName Ethernet

之后就可以愉快的局域网访问wsl了

GitHub 加速计划 / ws / WSL
8
0
下载
Issues found on WSL
最近提交(Master分支:4 个月前 )
235561ef 3 天前
d367de62 3 天前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐