Chaining SSH Tunnels

Last updated by Shayne M on May 22, 2013 09:13

SSH Tunnelling is a very powerful tool that's capable of many advanced configurations. This tutorial will show one example type of configuration, double tunnelling. It would allow you to connect to your closest server, and then your traffic gets forwarded from there to another location before being sent out to the greater internet and back again.

This would give you the advantage of having compression and faster response times by using a nearby server, and still being able to access geoblocked services in a separate country to your own. 

The below examples assume you want to connect to our Australian server, and forward connections through to our West Coast USA5 server.

On Linux:

You will need 2 different terminal windows open to set this up. One for the initial tunnel to Australia, and setting up port forwarding to US5, and a second to connect to the US5 tunnel and login there before opening a local socks5 proxy that goes to US5 via AU1.

In terminal 1: 

ssh -N -p 443 -C -L yourusername@ssh-au1.vpnsecure.me

This will prompt for your VPNSecure password, before opening local port 9001, and forwarding all traffic to the US5 SSH server.

In terminal 2:

ssh -N --p 9001 -C -D yourusername@

This will prompt for your VPNSecure password, before opening a SOCKS proxy on local port 8080 that forwards all traffic via the last tunnel to US5.

At this point, you would configure your browsers and application to use the SOCKS proxy on port 8080.

Network sniffers at this point would only see traffic going to the Australian server, but any sites you visit will see you as being in West Coast USA.

VPNSecure Provides Secure VPN servers in over 45+ Countries

If you are a looking for a versatile easy to use VPN service, checkout Today