Tunnel your HTTP traffic with ssh

From XPUB & Lens-Based wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Here is the situation, you want to hide your IP behind a proxy, you need to access a resource that is blocking your IP but not the one of your proxy, etc.

You can do all that if you have an ssh account on another machine, using your ssh connection as an HTTP proxy (SOCKS type) is very easy.

  • Open a connection to the server/machine you want to tunnel your traffic through:
ssh -D 12345 user@superserver

This will open a normal ssh session to superserver and create a SOCKS proxy on your local machine on port 12345.

  • Go to your browser's networking preferences and select SOCKS as proxy pointing to your localhost on port 12345. For example on firefox:

Socks.png

Notes

  • You can just open a tunnel in the background without requesting a shell session:
ssh -fND 12345 user@superserver
  • While you will be able to hide your real IP from the other servers you are connecting to, your IP and your actions can be easily traced back to your account on the server you're sshing in.