Skip to content

Instantly share code, notes, and snippets.

@timyhac
Created June 22, 2016 03:09
Show Gist options
  • Save timyhac/bce0b76805f9e5e22fefe7ac9c599867 to your computer and use it in GitHub Desktop.
Save timyhac/bce0b76805f9e5e22fefe7ac9c599867 to your computer and use it in GitHub Desktop.
Set up and teardown port forwarding to a remote target PC on a VPN
set LISTENADDRESS=10.40.1.10
set CONNECTADDRESS=10.1.1.20
netsh interface portproxy add v4tov4 listenport=80 listenaddress=%LISTENADDRESS% connectport=63000 connectaddress=%CONNECTADDRESS%
netsh interface portproxy add v4tov4 listenport=2222 listenaddress=%LISTENADDRESS% connectport=63001 connectaddress=%CONNECTADDRESS%
netsh interface portproxy add v4tov4 listenport=44818 listenaddress=%LISTENADDRESS% connectport=63002 connectaddress=%CONNECTADDRESS%
netsh interface portproxy show all
pause
netsh interface portproxy delete v4tov4 listenport=80 listenaddress=%LISTENADDRESS%
netsh interface portproxy delete v4tov4 listenport=2222 listenaddress=%LISTENADDRESS%
netsh interface portproxy delete v4tov4 listenport=44818 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