2008/09/20

[ LOS ] Reverse SSH Tunnel

使用 OpenSSH 的反向安全通道 ( Reverse SSH Tunneling ) 替自己公司 NAT 內部不對外開放的私有 IP Server 建立安全通道,OpenSSH 真的是一套很好用的軟體。

A_Host(IP:138.47.99.99) : 公司外部的真實 IP Unix/Linux Server
B_Host(IP:192.168.20.55) : 公司內部的虛擬 IP Unix/Linux Server

架構 : Destination (192.168.20.55) <- | NAT | <- Source (138.47.99.99)

1. 從公司內 Server 打洞到公司外的 Server

(A_Host)#
ssh -R 19999:localhost:22 sourceuser@138.47.99.99

2. 查看本機

(A_Host)# ps -ax |grep ssh
3732 pts/0 S+ 0:00 ssh -R 19999:localhost:22 jim@138.47.99.99
3737 ? Ss 0:00 sshd: jim [priv]
3739 ? S 0:00 sshd: jim@pts/1

3. 從公司外連回公司內的主機

(B_Host)# ssh localhost -p 19999

Reference :


http://www.howtoforge.com/reverse-ssh-tunneling

0 意見: