Ssh 如何通过跳转框从远程服务器转发端口

Ssh 如何通过跳转框从远程服务器转发端口,ssh,Ssh,我不确定我是否使用了正确的术语“端口转发”。我要做的是连接到一个本地端口,该端口连接到专用网络上的远程服务器 本地-->跳转框-->服务器 在服务器上,Web服务器正在端口80上运行 在本地,我想让我的浏览器连接到localhost:8080并到达服务器的端口80。 跳转框是一个标准端口22 ssh服务器 这可能吗?我找到了答案: ssh <user>@<server ip> -o 'ProxyCommand ssh <user>@<jump box&g

我不确定我是否使用了正确的术语“端口转发”。我要做的是连接到一个本地端口,该端口连接到专用网络上的远程服务器

本地-->跳转框-->服务器

在服务器上,Web服务器正在端口80上运行 在本地,我想让我的浏览器连接到localhost:8080并到达服务器的端口80。 跳转框是一个标准端口22 ssh服务器

这可能吗?

我找到了答案:

ssh <user>@<server ip> -o 'ProxyCommand ssh <user>@<jump box> nc <server ip> 22 2>/dev/null' -f -L <local port>:localhost:<server port> -N

更新的版本更容易
ssh jsmith@web.local -o 'ProxyCommand ssh jsmith@gateway.example.com nc web.local 22 2>/dev/null' -f -L 8080:localhost:80 -N