Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

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
Source by superuser.com #
 
PREVIOUS NEXT
Tagged: #access #wiindows #host
ADD COMMENT
Topic
Name
6+3 =