Linux Ssh Tunneling or Port Forwarding Local and Remote Ports with Examples?

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/linux-ssh-tunneling-or-port-forwarding-local-and-remote-ports-with-examples/
PINTEREST
PINTEREST
INSTAGRAM

Ssh protocol secure remote connections which is shell or terminal based to the remote systems. Ssh protocol and tool provides more than that. We can use ssh to create tunnels over local and remote systems or connect remote system X server. In this tutorial we will look how to tunnel and port forward locally and remotely.

Local Port Forwarding – Forward or Tunnel Local System Port To Remote System Port

Local port forwarding or tunneling is used to forward given local port to the given remote system port. We need to specify three things

  • LOCAL_PORT
  • DESTINATION_HOST
  • DESTINATION_PORT

and the syntax is like below.

In this example we will connect to the 192.168.122.22 with ssh and forward our local 2222 port to the poftut.com 2222 port like below.

Local Port Forwarding

Remote Port Forwarding – Forward or Tunnel Remote System Port To Local System Port

This is the same operation where the given remote port is connected to the given local port. We will connect remote system port 22 to our local system port 2222 . We will just change -L local option to the -R remote option.

Dynamic Port Forwarding

Dynamic port forwarding will use SOCKS which default port number is 1080. But another port number can be used. SOCKS generally used to proxy browsers like Chrome, Firefox, Opera. Proxy traffic will be forwarded to the remote system.

LEARN MORE  What Is TCP/IP Model?

Dynamic Port Forwarding

Dynamic Port Forwarding

X11 Forwarding

Linux systems uses for GUI X11 server. One of the best feature of SSH is remote application with GUI can be run on local system. Application actually runs on remote system but GUI or X11 protocol is forwarded to the local system and shown like a local application. To enable forwarding provide -X parameter.

X11 Forwarding

X11 Forwarding

OR

Just with a single shot

X11 Forwarding

X11 Forwarding

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/linux-ssh-tunneling-or-port-forwarding-local-and-remote-ports-with-examples/
PINTEREST
PINTEREST
INSTAGRAM

You may also like...

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)