Linux 101 : SSH tunnels - Local and remote port forwarding -
Local Port Forwarding:
Local Port Forwarding forwards a connection from the local host to the SSH server host, before forwarding it again to the destination host.
The local machine connects to the SSH server, while listening on the local port 5000.
When we connect to the local machine on port 5000, SSH will start a connection from the SSH server to the destination host on port 25.
When we connect to the local machine on port 5000, SSH will start a connection from the SSH server to the destination host on port 25.
Remote Port Forwarding:
Below is the command that achieves that:
Sets up an SSH connection with the SSH server, the SSH server is listening to connections on port 5000.
When we connect to port 5000 on the SSH server, SSH will open
a connection from the client to the port 25 of the destination host.
a connection from the client to the port 25 of the destination host.
Remark:
We could optionally mention the user on the SSH server using the below syntax "user@ssh_server".
Comments