Sunday, July 8, 2007

How to setup an SSH tunnel?

SSH is a powerful daemon that can do much more than simply log you into a server. One particularly useful function it provides is tunneling, whereby you can connect a client on your computer to a remote server and run a service you might not otherwise be able to access.

Tunneling will only work for applications that run over a TCP-based protocol and that allow you to specify what port the client should connect to. It is quite simple to setup a tunnel; all you have to do is tell SSH which port on your computer (the local port) is to be connected to which port on the remote server (the remote port), and then tell your client to use that local port. By default clients usually go straight to the remote port.

Commandline SSH :-

The basic form of the command is:ssh -L :localhost: where is an unused high-number port on your pc, eg. 2300, 14328 or 45000 is the well-known port for the service you wish to useand is one of CSE's general access servers, eg. hummel, wagner or weillthen point your local client's port configuration to localhost:. There are variations on this basic form which you can experiment with, see the manpage.

PuTTY :-

*In the side menu click on Connection->SSH->Tunnels .
*if you will be running X11 programs, select X11 Forwarding. Leave X Display Location as localhost:0
*do not select 'local ports accept connections from other hosts' under Port Forwarding unless you have a particular reason for doing so
*under Add New Forwarded Port fill in the values for Source Port and Destination, select Local.
*click Add and Open

SSHWinclient :-


*In the top bar click on Edit->Settings->Profile Settings->Tunneling
*click Add
*enter a Display Name if you desire
*leave Type as TCP
*fill in the values for the Listen Port (local port), Destination host and port
*select Allow Local Connection only and click OK
*select Tunnel X11 if you will be running X11 programs
*select Enable for SSH1 connections, click OK

No comments: