这里有一个SSH的端口转发教程,写的很清楚:
对于端口转发的逻辑:
https://lotabout.me/2019/SSH-Port-Forwarding/
本地端口转发:
ssh -L <port_a>:<remote host>:<port_b> user_b@ip_b
远程端口转发
ssh -R <port_a>:<remote host>:<port_a> user_a@ip_a
路由转发
ssh -g -L <port_a>:<remote host>:<port_b> user_b@ip_b