【发布时间】:2016-04-02 13:27:01
【问题描述】:
我实际上对这个问题摸不着头脑。
我为port-forwarding via multiple ssh-hops 找到了这个出色的指南。
按照本指南,我尝试了这个:
这行得通:
$ ssh -t hop -L 9080:localhost:9080 \
> ssh -A -t user@192.168.1.100 -L 9080:localhost:9080
使用 .ssh/config
Host hop
User extUser
IdentityFile ~/.ssh/id_rsa.company.pub
Hostname company.com
ForwardAgent yes
Port 11000
这实际上打开了我机器上的一个端口,通过 hop 到 100 目标机器的 9080 端口的服务。
跃点服务器可以访问192.168.1.100:9080(即wget 192.168.1.100:9080成功)
所以根据指南,这应该也可以:
ssh -L 9080:192.168.1.100:9080 hop
但事实并非如此。它打开到跳跃 ssh 点的连接(-f -N)会阻止这种情况)但隧道不会转发到目的地。我错过了什么?
当然最后应该全部在 .ssh/config 中:
Host tunneled-9080
User extUser
IdentityFile ~/.ssh/id_rsa.company.pub
Hostname company.com
ForwardAgent yes
Port 11000
LocalForward 9080 192.168.1.100:9080
很简单
ssh -f -N tunneled-9080
这就是我所需要的。
我错过了什么?
【问题讨论】:
-
你的问题是off-topic这里。
-
那么,@Martin 会在哪里成为话题?
-
@MartinPrikryl : 有人可以把它移到serverfault.com 吗?
-
Super User 更合适,imo。
标签: linux ssh portforwarding ssh-tunnel