Tunneling Via SSH

Submitted by xwings
on September 21, 2003 - 11:19pm
Title  : Tunneling Via SSH
OS     : ALL
Distro : - NA -
URL    : http://www.openssh.org

Installation :

	The installation on SSH, please check :-
			http://kerneltrap.org/node/view/868


Forward and Reverse Tunneling :

i. A Forward SSH Tunnel  
	
	I need to do a VNC back into my house's LinuxBox. 
	To make sure the conection is secure, what i can do is
	tunnel my connection by using ssh.
	
	First of all, you need a SSH server running on the RemoteHost.
	Your computer must have a ssh client software (Windows using putty).
		
	Activation :
	# ssh -l UserName -C -v -L 5902:RemoteHost:1234 RemoteHost

	Port 5902 is the port belongs to VNC server.
	
	After activate the tunnel, i turn on my vnc client and point 
        to localhost port 1234.(simple view , 127.0.0.1:1234).

        My vnc client will goto port 1234
	and tunneled by ssh goto the remote hosr server.

ii. A Reverse SSH Tunnel.

	What if i got a shell , i can accress to the interent and
	i can't login to my server from the internet.
	
	Can't login is due to the gateway don't do a port forwarding 
	in to the internel purpose due to some secutiry reason.
	
	What i can do is, ssh to one of the remote server and build 
	a tunnel. This tunnel will lead me to from the RemoteShell all
	the way to my internel server.
	
	By using this way, you can bypass the firewall.
	
	Activation :
	#ssh -R 1234:localhost:22 user@RemoteShell
	
	In this case , port 1234 will be remote tunnel port.
	
	After i leave the LAN and get back to my house,
	I just need to ssh into the RemoteShell.
	
	In the RemoteShell , I just need to
	# ssh localhost 1234

	That's it, i can go into the shell in the LAN.