Port Forwarding in Linux

SSH Port forwarding is used to forward ports between a local and a remote Linux machine using SSH protocol. It is mainly used to encrypt connections to different applications. Even if that application doesn’t support SSL encryption, SSH port forwarding can create a secure connection. You can even use port forwarding to expose a machine to the internet without an internet routable IP address, so that you can access it remotely and securely. There are many more uses of SSH port forwarding.

You should have SSH access to the server which you want to use for port forwarding.

Types of port forwarding

Local port forwarding

Remote port forwarding

Local port forwarding

In simple word, let’s you want to access application running on server1 on port 4444 and you want to access it on your local machine, like if you type localhost:9000 then should display the same application that running on server1 port 4444.

Let’s have a example: server1:4444 and i want to access it on my local machine localhost:9000

So if your local operating system is linux then follow this command.

ssh -L 9000:server1:4444 localhost

Port Forwarding in Linux
Show Buttons
Hide Buttons