SSH隧道打洞技巧


SSH Tunnel有三種,分別是Local模式(ssh -NfL),Remote模式(ssh -NfR),Dynamic模式(ssh -NfD)。

 

基本參數說明:

-N
   不執行任何命令

-f
  在背景執行

-L [bind_address:]port:host:hostport
  Specifies that the given port on the local (client) host is to be forwarded to the given host and port on the remote side.
  打通client:port -> remote:port [正向]

-R [bind_address:]port:host:hostport
  Specifies that the given port on the remote (server) host is to be forwarded to the given host and port on the local side.
  打通remote:port -> client:port [反向] 

-D [bind_address:]port
  開啟遠程服務器的port端口,可用作socks5代理服務器。

  

Local模式

    本機到10.143.24.15:11000網絡不通,但本機能通過SSH連接10.143.24.15:22,那么我們可以通過本地隧道模式打通 127.0.0.1:11000 -> 10.143.24.15:11000
 

    本地隧道不通:

       

    配置本地隧道:

      

     登錄,然后保持終端不退出:

       

     測試:

         
       

 

Remote模式

    SVN Server部署在10.199.48.182:18080,內網有台編譯服務器 10.200.138.7。
    10.200.138.7   -> 10.199.48.182:18080(不通)
    10.199.48.182 -> 10.200.138.7:22 (通)
    這樣我么就可以在10.199.48.182上,通過remote模式,打通 10.200.138.7:18080 -> 10.199.48.182:18080
 
    配置遠程隧道:
    

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM