Skip to content

Instantly share code, notes, and snippets.

@adsurbum
Last active January 22, 2017 12:09
Show Gist options
  • Save adsurbum/3cd4f1132c35de92e859 to your computer and use it in GitHub Desktop.
Save adsurbum/3cd4f1132c35de92e859 to your computer and use it in GitHub Desktop.
ssh tunnel (proxy)
ssh -fN -L \*:27017:localhost:27017 remote
Forward from port 80 to 8081 (every request to port 80 will be transfered to 8081)
sudo ssh -L 80:localhost:8081 adsurbum@localhost
@adsurbum
Copy link
Author

-f for "fork into background" and -N for "run no command"

@adsurbum
Copy link
Author

sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8081
sudo iptables -t nat -I OUTPUT -p tcp -d 127.0.0.1 --dport 80 -j REDIRECT --to-ports 8081

another option

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment