Skip to content

Instantly share code, notes, and snippets.

@xbalaji
Created March 17, 2023 02:07
Show Gist options
  • Save xbalaji/21077cdf9af026a39e2097d5a59fc02e to your computer and use it in GitHub Desktop.
Save xbalaji/21077cdf9af026a39e2097d5a59fc02e to your computer and use it in GitHub Desktop.
wsl_host_port_forward.ps1
ip = wsl -- ip -o -4 -json addr list eth0 | python3 -c "import sys,json; print(json.load(sys.stdin)[0]['addr_info'][0]['local'])"
netsh interface portproxy add v4tov4 listenport=$port listenaddress=0.0.0.0 connectport=$port connectaddress=$ip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment