Using an SSH Tunnel as a VPN Alternative
2018-11-04
I've considered finding a VPN service to use while on public networks for safety and privacy, but I don't want to pay for the service, figure out which VPN providers (if any) are trustworthy, or install VPN clients.
I recently found a cheap alternative using SSH tunnels! Here's how to set it up on Pop!_OS Linux.
First, get a cheap virtual machine from a hosting company like Digital Ocean or Linode for as little as $5 per month.
Next, use the "ssh" command to open a tunnel to your server:
ssh -N -C -D 9090 user@server
The "-N" option will prevent ssh from executing any commands on the remote server and instead just forward traffic. The "-C" option compresses data sent through the tunnel. The "-D 9090" option sets the local port for the tunnel.
Next, configure your local machine to use the tunnel:
- Open Settings -> Network -> Network Proxy and click the gear icon.
- Select "Manual".
- In the "Socks Host" section, use "http://127.0.0.1" for the URL and "9090" for the port.
Finally, verify your traffic is routed through the SSH tunnel by checking your public IP address. If it matches your server's IP address, you're all set.