Difference between revisions of "Tunneling with OpenSSH"

From Linuxintro
imported>ThorstenStaerk
imported>ThorstenStaerk
Line 12: Line 12:
 
                                                                           |                                                          |
 
                                                                           |                                                          |
 
                                                                             -----------------------------------------------------------
 
                                                                             -----------------------------------------------------------
 +
On localhost issue
 +
ssh -L 2222:172.16.0.42:22 gateway
  
ssh -L 2222:172.16.0.42:22 gateway
+
Then you can e.g. scp from localhost to ''hidden'' by using gateway's port 2222.
  
 
= See also =
 
= See also =
 
* [[set up NAT]]
 
* [[set up NAT]]

Revision as of 18:13, 18 December 2013

SSH Tunneling or SSH port forwarding is typically useful if you have a network with a private segment like this:


                                                                           -----------------------------------------------------------
                                                                          |                                                           |
                                                                          |                                                           |
                           ---------                                -----------                    --------------                     |
                          |localhost|------------------------------|   gateway |------------------|  hidden      |                    |
                           ---------                               | 10.2.2.18 |                  | 172.16.0.42  |                    |
                                                                    -----------                    --------------                     |
                                                                          |                                                           |
                                                                           -----------------------------------------------------------

On localhost issue

ssh -L 2222:172.16.0.42:22 gateway

Then you can e.g. scp from localhost to hidden by using gateway's port 2222.

See also