我在 Windows 8.1(主机)上使用 VirtualBox 以客户机身份运行 Ubuntu 13.10。
昨天,我能够使用 SSH/SFTP/FTP 从主机登录到客户机,没有任何问题,速度真的很快。
几天前,我在 Windows(主机)上卸载了一些应用程序并安装了一些更新,现在当我尝试通过 SSH 或 FTP 连接时遇到了麻烦。第一个请求大约需要 5 或 10 秒。知道为什么会发生这种情况吗?
我已经尝试了一些方法: - 重新安装 VirtualBox - 在主机和客户机上禁用防火墙。 - 禁用 Dinwdows Defender。
在调试模式下使用 Filezilla:
Status: Connecting to files.ls...
Trace: Going to execute "C:\Program Files (x86)\FileZilla FTP Client\fzsftp.exe"
Response: fzSftp started
Trace: CSftpControlSocket::ConnectParseResponse(fzSftp started)
Trace: CSftpControlSocket::SendNextCommand()
Trace: CSftpControlSocket::ConnectSend()
Command: open "[email protected]" 22
Trace: Looking up host "files.ls"
Trace: Connecting to 192.168.0.105 port 22
Trace: Server version: SSH-2.0-OpenSSH_6.2p2 Ubuntu-6ubuntu0.1
Trace: Using SSH protocol version 2
Trace: We claim version: SSH-2.0-PuTTY_Local:_Aug__7_2013_21:25:06
Trace: Doing Diffie-Hellman group exchange
Trace: Doing Diffie-Hellman key exchange with hash SHA-256
Trace: Host key fingerprint is:
Trace: ssh-rsa 2048 a6:28:76:90:89:f5:94:21:a1:44:f7:ac:53:d1:6d:07
Trace: Initialised AES-256 SDCTR client->server encryption
Trace: Initialised HMAC-SHA1 client->server MAC algorithm
Trace: Initialised AES-256 SDCTR server->client encryption
Trace: Initialised HMAC-SHA1 server->client MAC algorithm
Command: Pass: ********
Trace: Sent password
Trace: Access granted
Trace: Opened channel for session
Trace: Started a shell/command
Status: Connected to files.ls
Trace: CSftpControlSocket::ConnectParseResponse()
Trace: CSftpControlSocket::ResetOperation(0)
Trace: CControlSocket::ResetOperation(0)
Trace: CFileZillaEnginePrivate::ResetOperation(0)
Status: Retrieving directory listing...
Trace: CSftpControlSocket::SendNextCommand()
Trace: CSftpControlSocket::ChangeDirSend()
Command: pwd
Response: Current directory is: "/home/marco"
Trace: CSftpControlSocket::ResetOperation(0)
Trace: CControlSocket::ResetOperation(0)
Trace: CSftpControlSocket::ParseSubcommandResult(0)
Trace: CSftpControlSocket::ListSubcommandResult()
Trace: state = 1
Trace: CSftpControlSocket::ResetOperation(0)
Trace: CControlSocket::ResetOperation(0)
Status: Directory listing successful
Trace: CFileZillaEnginePrivate::ResetOperation(0)
它会在这一行停留大约 3 秒;有时是 5 秒……
Trace: Initialised HMAC-SHA1 server->client MAC algorithm
谢谢。
答案1
我发现这是由 DNS 查找引起的延迟。我不得不禁用它:
编辑/etc/ssh/sshd_config
并禁用属性 UseDNS:
UseDNS no