How to proxy your web traffic via your Linux Server without a VPN?

Created on

In this video I will show you a pretty cool and easy way on how to proxy your web traffic without having to install a VPN or do any special server configuration by just using SSH tunneling!

All you would need is a server and SSH access.

You can use my DigitalOcean referral code to get a free $100 credit to spin up your own servers:

Free $100 DigitalOcean credit. 

The command that you would need to use is:

ssh -ND 1080

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

Rundown of the command:

-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. Make sure to choose SOCKS v5.

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.

Back to DevDojo