2010年11月28日 星期日

use ssh tunnel to connect

A: local machine, can access B
B: ssh server(windows can use openssh for ssh server)
C: A cannot access, but B can


in A, use:
ssh -NfL [A port]:[C IP]:[C port] [B id]@[B IP]

then in A machine you can use localhost:[A port] as [C IP]:[C port]



if B is not a ssh server but have ssh client
you can reverse ssh tunnel

in B, use:
ssh -NfR [A port]:[C IP]:[C port] [A id]@[A IP]

沒有留言: