1. 准备:
主机A:端口->a_port, 访问IP:a_host,用户:a_user
主机B:端口->b_port, 访问IP:b_host,用户:b_user
主机C: 端口->c_port, 访问IP:c_host,用户:c_user
2. 正向代理:主机A没法直接访问主机C,但是主机A可以访问主机B,主机B可以访问主机C,要达到主机A访问主机C的目标
在主机A执行命令:ssh -L a_port:c_host:c_port b_user@b_host
这样,主机A就可以通过a_port,访问到主机C
3. 反向代理:主机A没法直接访问主机C,但是主机C可以访问主机B,主机A也可以访问主机B,要达到主机A访问主机C
在主机C执行命令:ssh -R b_port:c_host:c_port b_user@b_host
这样,主机A可以通过b_port,访问到主机C
4. 参考资料:https://blog.csdn.net/dliyuedong/article/details/49804825
https://www.cnblogs.com/phpdragon/p/5314650.html
https://www.cnblogs.com/x_wukong/p/7113854.html