OpenSSH : SSH Port Forwarding2014/07/09 |
It's possible to forward a port to another port with SSH port forwarding.
For example, configure the forwarding settings that the 8081 on the local is forwarded to the 5901(VNC) on the local.
This example shows simply setting but it's possible to forward most ports to most ports on the local or on other servers. |
|
[1] | Start a VNC process on display #1 with a common user, next, Configure like follows. |
# forward the connection to 8081 to 5901 on local [cent@dlp ~]$ ssh -L 0.0.0.0:8081:localhost:5901 cent@localhost cent@localhost's password: # the password of the working user (it means the login to local to local) Last login: Thu Jul 10 01:35:15 2014 # confirm [cent@dlp ~]$ netstat -lnp | grep 8081 (Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.) tcp 0 0 0.0.0.0:8081 0.0.0.0:* LISTEN 3238/ssh # keep this session and go next # it's possible to start the process on background as a daemon
with "-f" option but then it needs to kill it by hand after working. |
[2] | Next, connect to the port configured above on the local. |
[3] | Just connected like follows. |
Port forwarding with Client Tools
|
It's possible to use the port forwarding function with tools which has it without configuring servers.
For example, connect to a server with VNC by using Putty's port forwarding.
|
|
[4] | |
[5] | Start Putty on the ClientPC and specify the destination server. |
[6] | Select [Connection] - [SSH] - [Tunnels] on the left menu and input any port which is free on the local PC on [Source port] field, and also input [(destination server):(port)] on [Destination] field. Next, click [Add] button. |
[7] | Make sure the setting is added and click [Open] button to connect. |
[8] | Login to the server and keep the session, and go next step. |
[9] | Start VNC client on the ClientPC and connect to [(localhost):(the port which you set as a source port)]. |
[10] | Just connected like follows. |
Sponsored Link |
|