与 Centos 6.5 VM 建立 SSH 连接需要很长时间

与 Centos 6.5 VM 建立 SSH 连接需要很长时间

我在 Virtual Box VM 中安装了 Centos 6.5。除了 SSH 登录外,一切都运行顺利。命令提示符需要很长时间才能显示。

加上一些冗长的描述:

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: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /Users/verhage/.ssh/id_rsa (0x7f82a2600350),
debug2: key: /Users/verhage/.ssh/id_dsa (0x0),

当然,我谷歌了一下,这似乎与挂起的反向 DNS 查找有关,对吧?我编辑了 /etc/ssh/ssh_config,它看起来像这样:

Host *
    UseDNS no
    GSSAPIAuthentication no
# If this option is set to yes then remote X11 clients will have full access
# to the original X11 display. As virtually no X11 client supports the untrusted
# mode correctly we set this to yes.
    ForwardX11Trusted yes
# Send locale-related environment variables
    SendEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
    SendEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
    SendEnv LC_IDENTIFICATION LC_ALL LANGUAGE
    SendEnv XMODIFIERS

如您所见,UseDNS 和 GSSAPIAuthentication 都设置为 no。由于将这些参数设置为 no 是我在网上能找到的唯一建议,那么我的问题可能出在哪里?

答案1

我也遇到了同样的问题。经过搜索,我找到了解决方案这里

添加以下行到/etc/resolv.conf

options single-request-reopen

相关内容