我有两个CentOS 7服务器(这个场景的Hypervisor和Relay )。我希望连接到Hypervisor上的VNC端口,它位于防火墙后面,使用Relay服务器,SSH向Hypervisor开放。
我要求Hypervisor与命令建立连接:
ssh -N -R 0.0.0.0:5912:127.0.0.1:5912 root@Relay
完成此操作后,可以通过以下方式连接到中继端口
telnet localhost:5912
我收到回复: RFB 003.008
当我使用指定的IP地址进行电信时:
telnet 1.2.3.4:5912
接力:连接被拒绝
注意,IP 1.2.3.4是Relay的NIC的IP,而不是NAT的IP。
我也无法从中继子网内的另一台服务器连接。
发布于 2019-08-16 11:27:12
默认情况下,sshd拒绝允许远程访问以这种方式转发的端口。这在ssh(1)
手册页面中有记录。
Specifying a remote bind_address will only succeed if the
server's GatewayPorts option is enabled (see sshd_config(5)).
GatewayPorts
的文档显示默认情况下是关闭的。由于它是安全敏感的,这是一个合理的默认。来自sshd_config(5)
:
GatewayPorts
Specifies whether remote hosts are allowed to connect to ports
forwarded for the client. By default, sshd(8) binds remote port
forwardings 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 con‐
nect. The argument may be no to force remote port forwardings to
be available to the local host only, yes to force remote port
forwardings 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.
https://serverfault.com/questions/979583
复制相似问题