Skip to content

Instantly share code, notes, and snippets.

@unicornist
Last active October 15, 2023 17:43
Show Gist options
  • Save unicornist/6c7e84cdd678853711c5fc2764083a86 to your computer and use it in GitHub Desktop.
Save unicornist/6c7e84cdd678853711c5fc2764083a86 to your computer and use it in GitHub Desktop.
Bidirectional network connection between WSL2 and Windows

Get WSL2 IP in Windows:

wsl hostname -i

Get Windows IP in WSL2:

export hostip=$(cat /etc/resolv.conf | grep nameserver | awk '{ print $2 }')

or

ip -o -4 -json addr list eth0 | jq .[0].addr_info[0].local -r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment