Posted By

pacifists on 05/05/11


Tagged

ssh proxy tunnel


Versions (?)

ssh proxy tunnel


 / Published in: Bash
 

  1. You want to make use of the ProxyCommand option of ssh. Here is an example that uses one machine to connect to another.
  2.  
  3. You can add the following to your ~/.ssh/config file.
  4.  
  5. Host viatunnel
  6. IdentityFile ~/.ssh/inside_server_rsa
  7. ProxyCommand ssh -i ~/.ssh/proxy_server_rsa user@gateway.mynetwork "nc inside.mynetwork 22"
  8. user myself
  9.  
  10. This will connect first to user@gatwway.mynetwork and use that to make a connection to myself@inside.mynetwork
  11.  
  12. Now typing: ssh viatunnel will connect using this configuration.
  13.  
  14. The ProxyCommand line basically runs 'nc' on the first hop of your connection and establishes a tunnel to port 22 on the second server. Then the outside ssh uses that to connect.
  15.  
  16. See ProxyCommand here at the openssh manual

Report this snippet  

You need to login to post a comment.