Create SSH tunnel to bypass proxy in ubuntu without using Putty

Many organizations and educational institutions using proxy or firewall to restrict Internet access. Creating SSH tunnel is one way to bypass proxy or firewall in organizations and schools. Most of the tutorials available on web are using putty software to make SSH tunnel. Those who are unable to install putty software, I am giving alternate solution to make SSH tunnel in Ubuntu, without installing any third party software (like putty).
SSH tunnel

We use SSH client to make tunnel, by default any Ubuntu and all *nix distribution comes with SSH client. Let start with basic idea of SSH tunnel then we move on to the SSH tunneling commands to bypass proxy.

What is SSH?

SSH (Secure shell) is remote login shell with secure connection. When connection is successfully established then remote shell is dropped to local machine. Communication between these two hosts is encrypted and secure. Looking like difficult? Well, I am giving you my short note, SSH is used to get the remote machine’s shell using encrypted connection.

What is Tunneling?

Tunneling means connection in a connection i.e. one connection is encapsulated with another connection.

Requirements

  • Ubuntu or any unix distribution that has SSH client
  • A SSH Server outside from your proxy (or network) accessible from your machine.

Our idea is connect to ssh server and route all traffic through that connection.

Step 1: Accessibility of SSH server

Find one SSH server. You can use free ssh server or you can buy it from service provider. Currently I don't have any list of free ssh server providers. I will list here if I found free ssh servers. In this tutorial I am assuming 192.168.3.4 is my SSH server. Here you can find list of free shell providers at following link http://shells.red-pill.eu/.

After finding ssh server make sure that you have accessebility. You can do accessibility test by following command.


ping 192.168.3.4

If you got response from this command, bingo!! you have accessibility to the ssh server.


Step 2:Find SSH server port

If you know ssh server ip and port skip this step. By default SSH servers run on port 22. If You have ip address but you dont know the port number. Don't worry this command will helps you.

nc -v 192.168.3.4 20-1000

This command helps you to connect remote ip(192.168.3.4) with different ports ranging from 20 to 1000. You can change the range. Or else you can use any third party tool that finds services running on different ports. In this tutorial my SSH server is running on port number 22.

Step 3: Connect to ssh server
Connect to the ssh server by using following command.

ssh -D 8080 192.168.3.4 -p 22

Here 8080 is your machine's port. You can change on your wish. By default 8080 port is binds to localhost. If you want to change binding address run the following command.

ssh -D 192.168.3.3:8080 192.168.3.4 -p 22

Here 192.168.3.3 is my local IP. You can change it with your IP address.
Note:Replace IP and port number with your SSH server ip and port. And also you may asked to enter credentials for SSH server to connect. Thats it. You successfully created ssh tunnel.

Step 4: Set proxy settings in your browser.
If you binded your local ip with port(8080) then Set socks proxy field with ip as 192.168.3.3 and port as 8080, else set socks proxy as localhost and port as 8080.

We love your feedback and your support. If above commands dont work for you feel free to comment us we will help you.
Share on Google Plus

About Hari krishna

ThoughtWorker, Computer Science graduate from India. I am passionate programmer, blogger, thinker. I love open-source and linux. I love making friends. Just send me 'hi' to any of my social profiles. I love helping people.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment

We love your Feedback