VPN’s are great. I moved to Wireguard a while ago and I haven’t looked back. However, sometimes, especially on my laptop, I need a quick VPN. This is the fastest solution I’ve found.
It uses SSH to create an encrypted tunnel and also creates a local SOCKS server. You then configure Firefox to direct all requests to the SOCKS server on localhost that are directed down the tunnel where they exit and travel on to the destination web server.
This has all the benefits of a VPN i.e. the requests appear to originate from the server’s IP and not your IP and encrypts all your browser traffic between your system and your server.
Here’s how to set it up.
Create the SSH tunnel
Open a terminal on your local machine and SSH into your server with the following command:
ssh -D <PORT> <USER>@<HOST>
E.g:
ssh -D 8080 root@example.com
You can choose any port you want, it makes no difference. The tunnel will stay open as long as you are logged into the server and the terminal is open.
When you run this the SOCKS proxy will be listening on 127.0.0.1:8080
. So now, configure Firefox to use it.
Configure Firefox
Go to:
Burger Menu -> Preferences -> Network Settings
And do the following:
- Check Manual proxy configuration
- Set SOCKS Host to
127.0.0.1
- Set Port to
8080
- Click OK
When you’re done set the set the Firefox proxy back to No Proxy. You’re proxy settings will get remembered so you just need to check Manual proxy configuration to start using it again.
I do this quite a lot so I use the excellent FoxyProxy Basic so I can enable and disable using the proxy from the tool bar.