PortForwarding

https://help.ubuntu.com/community/SSH/OpenSSH/PortForwarding
1. Các loại PortForwarding
– Local port forwarding:
+ Connect from your local computer to another server
+ ssh -L 8080:www.ubuntuforums.org:80
Where should be replaced by the name of your laptop. The -L option specifies local port forwarding. For the duration of the SSH session, pointing your browser at http://localhost:8080/ would send you to http://www.ubuntuforums.org/
+ ssh -L 8080:www.ubuntuforums.org:80 -L 12345:ubuntu.com:80
This would forward two connections, one to http://www.ubuntuforums.org, the other to http://www.ubuntu.com. Pointing your browser at http://localhost:8080/ would download pages from http://www.ubuntuforums.org, and pointing your browser to http://localhost:12345/ would download pages from http://www.ubuntu.com

– Remort port forwarding
+ Connect from the remote SSH server to another server
+ ssh -R 5900:localhost:5900 guest@joes-pc
The -R option specifies remote port forwarding. For the duration of the SSH session, Joe would be able to access your desktop by connecting a VNC client to port 5900 on his computer (if you had set up a shared desktop)

– Dynamic port forwarding
+ Turns your SSH client into a SOCKS proxy server
+ ssh -C -D 1080 laptop

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s