SSH总结
本地端口转发
# client 运行
ssh -L [bind_ip:]local_port:target_ip:target_port user@server_ip
SSH Tunnel
--------> Client <-------------------> SSH Server <--------------> Target
[127.0.0.1] ... server_ip ... target_ip
local_port ... 22 ... target_port
- bind_ip:默认localhost,客户机器仅监听本机环回ip包
- target_ip:若为localhost,则目标机是SSH服务器
远程端口转发
# client 运行
ssh -R [bind_ip:]remote_port:target_ip:target_port user@server_ip
SSH Tunnel
--------> SSH Server <-------------------> Client <--------------> Target
[127.0.0.1] server_ip ... ... target_ip
remote_port 22 ... ... target_port
-
bind_ip:默认localhost,SSH服务器仅监听本机环回ip包;若设为0.0.0.0,则SSH服务器监听所有网卡的端口(需在SSH服务器中配置 GatewayPorts yes)
-
target_ip:若为localhost,则目标机是客户机

浙公网安备 33010602011771号