Public network connectivity.
Option 1: Just forward the ports from your host to your vm using https://gist.github.com/xmeng1/aae4b...1ee764928f5486
Option 2: Bridge mode.
Code:
Open Hyper-V Manager as administrator
Select your pc, open Virtual Switch Manager
Select WSL
Set to external network
Select the network card the traffic runs through
sudo ip addr flush dev eth0
sudo dhclient eth0
Now, you gotto get nameservers working:
rm /etc/resolv.conf
echo "nameserver 8.8.8.8" >> /etc/resolv.conf
And disable the automatic generation of it:
Create a file: /etc/wsl.conf
Put this in it:
[network]
generateResolvConf = false
Now, kill the vm with wsl --shutdown from your host machine, and restart it by running wsl
The part with
Code:
sudo ip addr flush dev eth0
sudo dhclient eth0
Might need to be re-run every boot.