Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Difference Between SSH Local and Remote Port Forwarding

  • Last Updated : 24 Oct, 2021

SSH stands for “Secure Shell” or “Secure Socket Shell“. It is a cryptographic network protocol that allows two computers to communicate and share the data over on insecure network such as Internet. SSH protocols protects the network from various attacks. 

1. Local Port Forwarding :
Local Port Forwarding is the common type of port forwarding. It is used to let a user connect from the local computer to another server, i.e forward data securely from another client application running on the same computer as a Secure shell client. By using local port forwarding , firewalls that block certain web pages are able to Bypass.

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.

 

2. Remote Port Forwarding :
This form of port forwarding enables applications on the server side of a secure shell. There are proprietary for the same general purpose. To use remote port forwarding the address of the destination server and two port number must be known. The port number chosen depend on which application is to be used.



Difference Between SSH LPF vs SSH RPF:

 SSH LPF

SSH RPF

In this, connections from the SSH client are forwarded via the SSH server, then to a destination server.In this, connections from the SSH server are forwarded via the SSH client, then to a destination server.
LPF lets you to connect from your local computer to another server.RPF lets you connect from the remote SSH server to another server.
In OpenSSH, local port forwarding is configured using the -L option.In OpenSSH, local port forwarding is configured using the -R option.

The basic syntax for LPF with Linux is:

ssh -L local_port:destination_server_ip:remote_port ssh_server_hostname

The basic syntax for RPF with Linux is:

ssh -R local_port:destination_server_ip:remote_port ssh_server_hostname

For example: If you wanted to connect from your laptop to 

http://www.ubuntuforums.org using an SSH tunnel. You would 

use source port number 8080 and destination port 80 and destination server www.ubuntuforums.org

For example: If you wanted to let a friend access your remote desktop, using the command-line SSH client. 

You would use port number 5900 and destination server localhost :

ssh -R 5900: localhost : 5900 guest@jone-pc

My Personal Notes arrow_drop_up
Recommended Articles
Page :