Skip to content

Instantly share code, notes, and snippets.

@timyhac
Created June 22, 2016 03:09
Show Gist options
  • Save timyhac/8ec96786b6933c9a396d95c2ac84f06e to your computer and use it in GitHub Desktop.
Save timyhac/8ec96786b6933c9a396d95c2ac84f06e to your computer and use it in GitHub Desktop.
Set up and tear down port forwarding for a remote host attached to a VPN
set LISTENADDRESS=192.168.1.58
set CONNECTADDRESS=10.1.1.10
netsh interface portproxy add v4tov4 listenport=63000 listenaddress=%LISTENADDRESS% connectport=80 connectaddress=%CONNECTADDRESS%
netsh interface portproxy add v4tov4 listenport=63001 listenaddress=%LISTENADDRESS% connectport=2222 connectaddress=%CONNECTADDRESS%
netsh interface portproxy add v4tov4 listenport=63002 listenaddress=%LISTENADDRESS% connectport=44818 connectaddress=%CONNECTADDRESS%
netsh interface portproxy show all
pause
netsh interface portproxy delete v4tov4 listenport=63000 listenaddress=%LISTENADDRESS%
netsh interface portproxy delete v4tov4 listenport=63001 listenaddress=%LISTENADDRESS%
netsh interface portproxy delete v4tov4 listenport=63002 listenaddress=%LISTENADDRESS%
netsh interface portproxy show all
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment