SSH Tunnel - Proxy Your Web Traffic Through Your Remote Web Server

SSH Tunnel - Proxy Your Web Traffic Through Your Remote Web Server


This article will show you a pretty cool and easy way on how to proxy your web traffic by using SSH tunneling.

All you would need is a server and Shell access.

You would need to run the following command:

ssh -ND 1080 [email protected]

There would be no output. This would open a socket that we would use to connect to and proxy our network traffic.

-N Do not execute a remote command. This is useful for just forwarding ports also hides the output from the SSH connection.
-D 1080 creates a local “dynamic” application-level port forwarding, in this case 1080, on your local computer. Whenever a connection is made to this port, the connection is forwarded over the secure channel, and the application protocol is then used to determine where to connect to from the remote machine. Currently the SOCKS4 and SOCKS5 protocols are supported, and ssh will act as a SOCKS server.

One you have the socket ready you can use any browser to connect to the SSH tunnel. In my case I would use Firefox.

You need to go to Preferences -> Advanced -> Network -> Settings -> And update your Configure Manual proxy configuration.

Update the SOCKS HOST to localhost and the port to 1080.


This is pretty much it, now all of your Web Traffic would be routed through your Web Server:


To stop the SSH tunnel, just interrupt the SSH connection and change your Firefox settings back to No Proxy.

If you have any questions, please feel free to contact me.