Proxycommand 和 ncat 不适用于动态端口转发

Proxycommand 和 ncat 不适用于动态端口转发

我正在尝试使用动态端口转发通过跳转机从 Centos7 服务器连接到某些设备。

我有这个 .ssh/config:

*Host jump
        TCPKeepAlive yes
        ServerAliveInterval 1200
        HostName x.x.x.x
        DynamicForward 1080
Host hl*
        ProxyCommand nc -x 127.0.0.1:1080 %h %p*

Then I set up the dynamic port fwd in the jump machine:

*[root@host ~]#ssh -fN user@jump* 

Then when i try the ssh to the final device I get this error:

*[root@host ~]#ssh user@hl4man1 -vv
OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017
debug1: Reading configuration data /root/.ssh/config
debug1: /root/.ssh/config line 10: Applying options for hl*
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 58: Applying options for *
debug1: Executing proxy command: exec nc -x 127.0.0.1:1080 hl4man1 22
debug1: permanently_set_uid: 0/0
debug1: permanently_drop_suid: 0
debug1: identity file /root/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
**Ncat: Could not resolve hostname "hl4man1": Name or service not known. QUITTING.
ssh_exchange_identification: Connection closed by remote host**
[root@host ~]#*

如果我进行静态端口转发,它就可以正常工作。

任何想法?

路易斯/Rgds

答案1

您无法代理到中间人找不到的主机。

Ncat: Could not resolve hostname "hl4man1": Name or service not known. QUITTING.
ssh_exchange_identification: Connection closed by remote host

尝试连接到代理主机可以找到的范围内存在的主机?

换句话说,如果鲍勃不知道拉里住在哪里,你就不能要求鲍勃从拉里家里拿东西。

相关内容