免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2433 | 回复: 3
打印 上一主题 下一主题

利用ssh进行端口转发的问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-03-22 23:28 |只看该作者 |倒序浏览
有三台机器,M1, M2 和 M3,
M2和M3 都能ssh连M1,但反向不行,即 M1 不能ssh连M2 和M3。
现在要实现M3和M2之间的ssh通讯。

现在试的办法是,
在M2 ssh连接M1的时候在M1机器上开一个9000端口转发到M2的22端口,使用命令:
ssh -R 9000:M1:22 M1

现在的问题是,在M1机器上可以实现通过9000端口访问M2,即:
“ssh -p 9000 M1”   可以。
然而在M3机器上执行这个命令却返回:“Connection refused”。也就是说打开的这个9000端口只允许本机(就是M1)访问,不允许其他机器(M3)访问。请问有解决的办法吗?



类似 “-g”的选项,(如果M1能够访问M2)在M1ssh连M2时执行 "ssh -gL 9000:M1:22 M2”。可问题就是现在只能单向的M2访问M1。而“-g”的选项在”ssh -gR 9000:M1:22 M1”时失效。

请问有谁碰到这样的情况吗?如何开放9000端口的权限?
非常感激!

论坛徽章:
0
2 [报告]
发表于 2010-03-23 10:03 |只看该作者
GatewayPorts
             Specifies whether remote hosts are allowed to connect to ports forwarded for the client.  By default, sshd binds remote port for-
             wardings to the loopback address.  This prevents other remote hosts from connecting to forwarded ports.  GatewayPorts can be used
             to specify that sshd should allow remote port forwardings to bind to non-loopback addresses, thus allowing other hosts to connect.
             The argument may be "no" to force remote port forwardings to be available to the local host only, "yes" to force remote port for-
             wardings to bind to the wildcard address, or "clientspecified" to allow the client to select the address to which the forwarding
             is bound.  The default is "no".

论坛徽章:
0
3 [报告]
发表于 2010-03-24 01:26 |只看该作者
Great! That hit the point.

Thanks very much!

论坛徽章:
0
4 [报告]
发表于 2011-03-08 10:35 |只看该作者
学习了
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP