If you're unable to use a VPN for various reasons, setting up your own SOCKS5 proxy can be a viable alternative to tunnel your traffic over SSH. The tunnel connection is encrypted. While it may not be a complete replacement of a VPN, as the tunnel needs to be set for each application individually, it can still offer a good level of privacy and security.
Run the following command in your terminal to create the SSH tunnel:
ssh -D 9999 -p 22 -C -N [email protected]
-
-D
: port number -
-p
: port to connect to remote host. If your network has a firewall or you're unable to use the default port22
for some reason, you can specify a different port that is open, such as port80
. -
-C
: compress data to save bandwidth -
-N
: tell ssh no command is sent through because we use just it for port forwarding. -
-f
: (optional), fork the process to the background
Once the tunnel is set, use your preferred browser to use the SOCKS tunnel proxy server. For example, if you're using Chromium, you can run the following command to start it with the SOCKS proxy server:
chromium --proxy-server="socks://127.0.0.1:9999" --incognito
If you prefer to use curl
, you can use the -x
parameter to specify the
SOCKS5 proxy:
curl -x socks5h://127.0.0.1:9999 ifconfig.me