ssh 内网穿透
- L 代理远程端口到本地: 本地 IP:本地端口:远程 IP:远程端口
- R 代理本地端口到远程: 远程 IP:远程端口:本地 IP:本地端口
- f 后台运行
- N 告诉
SSH
我们只建立隧道, 不会在远程服务器执行命令 - T 告诉
SSH
我们只希望创建隧道,而不需要创建虚拟终端 - C 允许
SSH
压缩数据
使用示例
代理远程服务器的 3306 端口到本地 3307
ssh -fNTCL '*':3307:127.0.0.1:3306 user@remoteHost
代理本地的 8888 端口到远程的 8889 端口
ssh -NTCR 127.0.0.1:8889:'*':8888 user@remoteHost