SSH连接从一台机器缓慢,但不是另一台

我有一个远程服务器需要通过VPNpipe理到另一个数据中心。 我用来从(服务器A)中得到的服务器正在退役,所以我在同一个VLAN上使用另一台服务器(sevrer B)。

服务器A和B运行相同版本的SSH(SSH-2.0-OpenSSH_4.3)并具有相同的/ etc / ssh / ssh_config文件。

服务器A和B都有RSA密钥,公共部分存储在远程机器上的.ssh / authorized_keys中。

当我从服务器A ssh到远程机器,我马上进来。

当我从服务器B ssh到远程机器,我必须等待大约20秒或更多。

我已经在详细debugging模式下运行ssh,它挂在服务器B上的部分在这里:

debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY debug3: check_host_in_hostfile: filename /home/user/.ssh/known_hosts debug3: check_host_in_hostfile: match line 1 debug1: Host '10.10.10.50' is known and matches the RSA host key. debug1: Found key in /home/user/.ssh/known_hosts:1 debug2: bits set: 493/1024 debug1: ssh_rsa_verify: signature correct debug2: kex_derive_keys debug2: set_newkeys: mode 1 debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug2: set_newkeys: mode 0 debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug2: service_accept: ssh-userauth debug1: SSH2_MSG_SERVICE_ACCEPT received debug2: key: /home/user/.ssh/identity ((nil)) debug2: key: /home/user/.ssh/id_rsa (0x7ff214705310) debug2: key: /home/user/.ssh/id_dsa ((nil)) ... 

这是20秒延迟的地步。 服务器B发生了什么事,不影响服务器A?

可能是反向dns查找延迟。 在服务器B上检查您的DNSconfiguration

你可以通过在sshd_config中设置'UseDNS no'来validation它是否有帮助。 (但是,如果有任何潜在的DNS问题,最好是解决这个问题)。