ssh 端口转发

正向代理
ssh -L 8000:host-d.prod.mycompany.com:8888 [email protected] -N
反向代理: 
ssh -R 8888:localhosthost-b.office.mycompany.com:22 [email protected] -N
动态端口转发 
ssh -D 8888 [email protected] -N

ok:
N参数,表示只连接远程主机,不打开远程shell

正向代理
ssh -L 9999:192.168.1.131:9010 [email protected]
然后本机访问:127.0.0.1:9999  相当于代理访问192.168.1.131:9010

ssh -L 192.168.0.104:9999:192.168.1.131:9010 [email protected]
然后访问:192.168.0.104:9999即可  相当于代理访问192.168.1.131:9010

反向代理:
ssh -R 9999:192.168.1.131:9010 [email protected] 
ssh -R 192.168.1.140:9999:192.168.1.131:9010 [email protected] 
ssh -R 192.168.0.104:9999:192.168.1.131:9010 [email protected] 
然后只能在192.168.1.140本机访问:127.0.0.1:9999 

动态端口转发
ssh -D 9999 [email protected]
ssh -D 9999:192.168.1.131:9010 [email protected] 
ssh -D 192.168.1.140:9999 [email protected]




你可能感兴趣的:(综合)