- reverse tunnel: 從家中主機連回公司的主機, 或是 firewall 只有 allow 單向 ssh 的狀況, 由目的主機主動建立 ssh tunnel.
#. on destination server (office host or firewall allow host)
ssh -fNR 9999:127.0.0.1:22 root@target_host -p 22
#. on target server (home host or firewall deny host)
ssh root@127.0.0.1 -p 9999 - dynamic application-level port forwarding: 被鎖 port 了, 先在牆的另外一邊搞一個ssh service port 在 80 的主機, 只要應用程式能使用 proxy 並且支援 socks 的, 將 socks server 指向 127.0.0.1:9999, 都可以用這個 ssh tunnel 翻.
ssh -fND 9999 root@remote_host -p 80
- combind 上述兩種 tunnel, 使被鎖 port 也無法上網的主機翻牆, 記得於應用程式內將 socks server 指向 127.0.0.1:8888, type 選擇 socks4.
#. on destination server (firewall allow host)
ssh -fNR 9999:127.0.0.1:22 root@target_host -p 22
#. on target server (firewall deny host)
ssh -fND 8888 root@127.0.0.1 -p 9999
ssh tunnel with openssh on linux box
poster:
MarlboroMoo on
2009-10-13
19:35
, update at 2009-10-14 14:08
tag:
linux,
ssh tunnel
在 linux 底下翻牆啦!
Related Posts:
- Linux cheatsheet - 2009-06-04
- ssh tunnel with proxychains in ubuntu 9.04 - 2009-10-15
- Strace with tomcat - 2010-08-25
- can't format or mount device with live cd - 2009-10-08
- book of linux's hack - 2009-10-04
0 comments:
張貼留言