Answers for "access wsl2 from network"

2

Connecting to WSL2 server via local network

netsh interface portproxy add v4tov4 listenport=<port-to-listen> listenaddress=0.0.0.0 connectport=<port-to-forward> connectaddress=<forward-to-this-IP-address>
Posted by: Guest on November-29-2021
0

access wiindows host from wsl2

# You should run the following command in a powershell run as administrator:
New-NetFirewallRule -DisplayName "WSL" -Direction Inbound  -InterfaceAlias "vEthernet (WSL)"  -Action Allow
# Then in WSL 2 add this line to your .profile
export hostip=$(cat /etc/resolv.conf | grep nameserver | awk '{ print $2 }')
# Then use 'hostip:<your-desired-port>' to access any service runnin on your windows host from inside WSL 2
Posted by: Guest on September-08-2021

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language