Guys you are thinking, what the hell is SSH and port forwarding…….
Basically ssh stands for Secure Shell and it works similar to other shell. Now, you are thinking why we called him secure because it encrypts the entire communication session. When you enter your login and password they are encrypted before being sent. Likewise, everything you type and everything that comes back to you is encrypted as long as you’re within that SSH session.
Port forwarding:It is a combination of routing by port combined with packet rewriting. A convention router examines the packet header and dispatches the packet on one of its other interfaces, depending on the packet’s destination address. Port Forwarding examines the packet header and forwards it on to another host (after a little header rewriting) depending on the destination port.
Now How to implement
Let Understand this through an example
This is a local port forwarding
Suppose we have PC1(192.168.2.10) and PC2 (192.168.2.11) are running on ubuntu.
Lets say the port no. of PC1 is 71
Then we find an unused port of PC2.Let suppose 480 is unused.
To execute port forwarding we use the following command
ssh -l 480:192.168.2.10:71 firstname.lastname@example.org
How to read this SSH Local Port Forwarding command syntax?
ssh -L LocalPort:ServiceHost:ServicePort SSHID@SSHHost
* LocalPort is a local TCP port
* ServiceHost is a remote host that provide the target service, such as email, VNC, etc
* ServicePort is a listening port of the target service at ServiceHost, i.e. 110 for POP3 email
* SSHID is a SSH login ID to the SSH server that can be connected to establish a secure / encrypted
* SSHHost is the remote host that running the SSH server