Wednesday, August 17, 2011

SSH Tunneling

SSH Tunneling is also known as SSH Port Forwarding. Using SSH Tunneling you can forward all traffic through the system on which you have ssh access. For example suppose you are inside a network in which port 25(smtp) is not allowed , and you need to send mail using smtp. The solution is SSH Tunneling. What you have to do is open a port on local system may be port no 3000 and do ssh tunneling so that all traffic thats coming on port 3000 get forwarded to remote system on which you have ssh access and that system allow smtp. For this you need to execute following command on your system

root# ssh -L 3000:202.125.250.x:25 sshuser@remotehostname -N

In above given example -L 3000:202.125.250.x:25 , 202.125.250.x is ip of remote system on which you have ssh access and smtp is allowed. The username for remote ssh access in mentioned as sshuser@remotehostname .

Now you need to mention smtp server as localhost:3000 in mail client.