SSH 反向代理

SSH反向代理

被控制端沒有NAT或者沒有靜態公網IP,把本端一臺服務器映射到外網給遠端SSH進來,創建SSH反向隧道。服務器

先映射本端機器到外網ssh

 nat server 2222to22 protocol TCP global 1.2.4.8 22 inside 10.10.10.10 22 no-reverse
 

被控端發起鏈接ide

 ssh -fCNR 8822:localhost:22 root@1.2.4.8 -p 2222
 
 # -f     Requests ssh to go to background just before command execution
 # -C     Requests compression of all data
 # -N     Do not execute a remote command
 # -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.

本端檢查鏈接ui

 ss -tunl |grep 8822
 # 鏈接被控端發起ssh鏈接監聽的8822端口,轉到被控端的22端口
 ssh root@127.0.0.1 -p 8822
 
相關文章
相關標籤/搜索