Tunneling via SSH without a VPNWed, Dec 26, 2018
Setting up a VPN can be time consuming, especially if you’re like me and aren’t familiar with OpenVPN. Luckily we can use SOCKS proxy settings to tunnel traffic via an SSH connection, which is much simpler to setup.
Get a server
If you have a server to tunnel via, you can skip this part. Otherwise you’ll need to setup a server you can SSH to. You could do this using AWS, DigitalOcean, Google Cloud, or whatever IaaS is hot right now.
Open an SSH connection to the server and SSH will act as a SOCKS server.
ssh -N -D <port> <user>@<ip>
ssh -N -D 1080 firstname.lastname@example.org
-NTells the other side we don’t want a shell or to execute a command, because we’re just port forwarding.
-D <port>The localhost port that will serve the SOCKS proxy.
<user>@<ip>The SSH server and username to connect to.
Configure your browser
Configure your browser to connect to the proxy that’s running on localhost. Depending on your OS and browser you set your SOCKS proxy up with:
Example (Mac OS):
Some browsers will let you also tunnel DNS via the SOCKS proxy. You may need to configure that too if that is important to you.