centos用ssh连接其他服务器慢

好好干活哇 发布于 2016/01/25 18:54
阅读 646
收藏 0

系统是centos6.5,用ssh连接内网服务器有的快一秒以内,有的慢,需要十几秒,配置都一样,实在是找不出原因,以下是测试过程,望大神指教。

[zhengbowen@BFG-OSER-1985 ~]$ ssh 192.168.221.51 -v
OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 192.168.221.51 [192.168.221.51] port 22.
debug1: Connection established.
debug1: identity file /home/zhengbowen/.ssh/identity type -1
debug1: identity file /home/zhengbowen/.ssh/identity-cert type -1
debug1: identity file /home/zhengbowen/.ssh/id_rsa type -1
debug1: identity file /home/zhengbowen/.ssh/id_rsa-cert type -1
debug1: identity file /home/zhengbowen/.ssh/id_dsa type -1
debug1: identity file /home/zhengbowen/.ssh/id_dsa-cert type -1

这一步后等十几秒才到下一步

debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
The authenticity of host '192.168.221.51 (192.168.221.51)' can't be established.
RSA key fingerprint is 74:04:49:4e:74:c6:81:3d:d0:3c:83:f7:21:83:ce:bd.
Are you sure you want to continue connecting (yes/no)? 

8:17:52 uname({sys="Linux", node="BFG-OSER-1985", ...}) = 0
18:17:52 open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 4
18:17:52 fstat(4, {st_mode=S_IFREG|0644, st_size=1663, ...}) = 0
18:17:52 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f61c3254000
18:17:52 read(4, "root:x:0:0:root:/root:/bin/bash\n"..., 4096) = 1663
18:17:52 close(4)                       = 0
18:17:52 munmap(0x7f61c3254000, 4096)   = 0
18:17:52 open("/home/zhengbowen/.ssh/identity", O_RDONLY) = -1 ENOENT (No such file or directory)
18:17:52 open("/home/zhengbowen/.ssh/identity", O_RDONLY) = -1 ENOENT (No such file or directory)
18:17:52 open("/home/zhengbowen/.ssh/identity", O_RDONLY) = -1 ENOENT (No such file or directory)
18:17:52 open("/home/zhengbowen/.ssh/identity.pub", O_RDONLY) = -1 ENOENT (No such file or directory)
18:17:52 open("/home/zhengbowen/.ssh/identity-cert", O_RDONLY) = -1 ENOENT (No such file or directory)
18:17:52 open("/home/zhengbowen/.ssh/identity-cert", O_RDONLY) = -1 ENOENT (No such file or directory)
18:17:52 open("/home/zhengbowen/.ssh/identity-cert", O_RDONLY) = -1 ENOENT (No such file or directory)
18:17:52 open("/home/zhengbowen/.ssh/identity-cert.pub", O_RDONLY) = -1 ENOENT (No such file or directory)
18:17:52 open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 4
18:17:52 fstat(4, {st_mode=S_IFREG|0644, st_size=1663, ...}) = 0
18:17:52 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f61c3254000
18:17:52 read(4, "root:x:0:0:root:/root:/bin/bash\n"..., 4096) = 1663
18:17:52 close(4)                       = 0
18:17:52 munmap(0x7f61c3254000, 4096)   = 0
18:17:52 open("/home/zhengbowen/.ssh/id_rsa", O_RDONLY) = -1 ENOENT (No such file or directory)
18:17:52 open("/home/zhengbowen/.ssh/id_rsa", O_RDONLY) = -1 ENOENT (No such file or directory)
18:17:52 open("/home/zhengbowen/.ssh/id_rsa", O_RDONLY) = -1 ENOENT (No such file or directory)
18:17:52 open("/home/zhengbowen/.ssh/id_rsa.pub", O_RDONLY) = -1 ENOENT (No such file or directory)
18:17:52 open("/home/zhengbowen/.ssh/id_rsa-cert", O_RDONLY) = -1 ENOENT (No such file or directory)
18:17:52 open("/home/zhengbowen/.ssh/id_rsa-cert", O_RDONLY) = -1 ENOENT (No such file or directory)
18:17:52 open("/home/zhengbowen/.ssh/id_rsa-cert", O_RDONLY) = -1 ENOENT (No such file or directory)
18:17:52 open("/home/zhengbowen/.ssh/id_rsa-cert.pub", O_RDONLY) = -1 ENOENT (No such file or directory)
18:17:52 open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 4
18:17:52 fstat(4, {st_mode=S_IFREG|0644, st_size=1663, ...}) = 0
18:17:52 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f61c3254000
18:17:52 read(4, "root:x:0:0:root:/root:/bin/bash\n"..., 4096) = 1663
18:17:52 close(4)                       = 0
18:17:52 munmap(0x7f61c3254000, 4096)   = 0
18:17:52 open("/home/zhengbowen/.ssh/id_dsa", O_RDONLY) = -1 ENOENT (No such file or directory)
18:17:52 open("/home/zhengbowen/.ssh/id_dsa", O_RDONLY) = -1 ENOENT (No such file or directory)
18:17:52 open("/home/zhengbowen/.ssh/id_dsa", O_RDONLY) = -1 ENOENT (No such file or directory)
18:17:52 open("/home/zhengbowen/.ssh/id_dsa.pub", O_RDONLY) = -1 ENOENT (No such file or directory)
18:17:52 open("/home/zhengbowen/.ssh/id_dsa-cert", O_RDONLY) = -1 ENOENT (No such file or directory)
18:17:52 open("/home/zhengbowen/.ssh/id_dsa-cert", O_RDONLY) = -1 ENOENT (No such file or directory)
18:17:52 open("/home/zhengbowen/.ssh/id_dsa-cert", O_RDONLY) = -1 ENOENT (No such file or directory)
18:17:52 open("/home/zhengbowen/.ssh/id_dsa-cert.pub", O_RDONLY) = -1 ENOENT (No such file or directory)
18:17:52 open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 4
18:17:52 fstat(4, {st_mode=S_IFREG|0644, st_size=1663, ...}) = 0
18:17:52 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f61c3254000
18:17:52 read(4, "root:x:0:0:root:/root:/bin/bash\n"..., 4096) = 1663
18:17:52 close(4)                       = 0
18:17:52 munmap(0x7f61c3254000, 4096)   = 0
18:17:52 open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 4
18:17:52 fstat(4, {st_mode=S_IFREG|0644, st_size=1663, ...}) = 0
18:17:52 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f61c3254000
18:17:52 read(4, "root:x:0:0:root:/root:/bin/bash\n"..., 4096) = 1663
18:17:52 close(4)                       = 0
18:17:52 munmap(0x7f61c3254000, 4096)   = 0
18:17:52 rt_sigaction(SIGPIPE, NULL, {SIG_DFL, [], 0}, 8) = 0
18:17:52 rt_sigaction(SIGPIPE, {SIG_IGN, [], SA_RESTORER, 0x7f61c0db46a0}, NULL, 8) = 0
18:17:52 read(3, "S", 1)                = 1
18:18:02 read(3, "S", 1)                = 1(这一步等了10秒)
18:18:02 read(3, "H", 1)                = 1
18:18:02 read(3, "-", 1)                = 1
18:18:02 read(3, "2", 1)                = 1
18:18:02 read(3, ".", 1)                = 1
18:18:02 read(3, "0", 1)                = 1
18:18:02 read(3, "-", 1)                = 1
18:18:02 read(3, "O", 1)                = 1
18:18:02 read(3, "p", 1)                = 1
18:18:02 read(3, "e", 1)                = 1
18:18:02 read(3, "n", 1)                = 1
18:18:02 read(3, "S", 1)                = 1
18:18:02 read(3, "S", 1)                = 1
18:18:02 read(3, "H", 1)                = 1
18:18:02 read(3, "_", 1)                = 1
18:18:02 read(3, "5", 1)                = 1
18:18:02 read(3, ".", 1)                = 1
18:18:02 read(3, "3", 1)                = 1
18:18:02 read(3, "\r", 1)               = 1
18:18:02 read(3, "\n", 1)               = 1
18:18:02 write(3, "SSH-2.0-OpenSSH_5.3\r\n", 21) = 21
18:18:02 fcntl(3, F_GETFL)              = 0x2 (flags O_RDWR)
18:18:02 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0
18:18:02 write(3, "\0\0\3\274\4\24\27\213\0\250TdR\265\5G9\337\322L)\3\0\0\0~diffie"..., 960) = 960
18:18:02 select(4, [3], NULL, NULL, NULL) = 1 (in [3])
18:18:02 read(3, "\0\0\3D\n\24\335k\300\307\305\324!~7V\3076\323y\362\321\0\0\0~diffie"..., 8192) = 840
18:18:02 write(3, "\0\0\0\24\6\"\0\0\4\0\0\0\4\0\0\0 \0\0\0\0\0\0\0", 24) = 24
18:18:02 select(4, [3], NULL, NULL, NULL) = 1 (in [3])
18:18:02 read(3, "\0\0\0\224\10\37\0\0\0\201\0\336I\374\220i\231L7\235+ec\357\323~\372\346x^\353\35"..., 8192) = 152
18:18:02 write(3, "\0\0\0\214\6 \0\0\0\200&\360\233\271\273_\214\347D\221\365:\326\371W\306rIU\357\24\340"..., 144) = 144
18:18:02 select(4, [3], NULL, NULL, NULL) = 1 (in [3])
18:18:02 read(3, "\0\0\2\274\t!\0\0\1\25\0\0\0\7ssh-rsa\0\0\0\1#\0\0\1\1\0\236"..., 8192) = 720
18:18:02 stat("/etc/ssh/ssh_known_hosts2", 0x7fffad6cbb00) = -1 ENOENT (No such file or directory)
18:18:02 stat("/home/zhengbowen/.ssh/known_hosts2", 0x7fffad6cbb00) = -1 ENOENT (No such file or directory)
18:18:02 open("/home/zhengbowen/.ssh/known_hosts", O_RDONLY) = -1 ENOENT (No such file or directory)
18:18:02 open("/home/zhengbowen/.ssh/known_hosts", O_RDONLY) = -1 ENOENT (No such file or directory)
18:18:02 open("/etc/ssh/ssh_known_hosts", O_RDONLY) = -1 ENOENT (No such file or directory)
18:18:02 open("/etc/ssh/ssh_known_hosts", O_RDONLY) = -1 ENOENT (No such file or directory)
18:18:02 open("/home/zhengbowen/.ssh/known_hosts", O_RDONLY) = -1 ENOENT (No such file or directory)
18:18:02 open("/etc/ssh/ssh_known_hosts", O_RDONLY) = -1 ENOENT (No such file or directory)
18:18:02 open("/home/zhengbowen/.ssh/known_hosts2", O_RDONLY) = -1 ENOENT (No such file or directory)
18:18:02 open("/etc/ssh/ssh_known_hosts2", O_RDONLY) = -1 ENOENT (No such file or directory)
18:18:02 open("/home/zhengbowen/.ssh/known_hosts", O_RDONLY) = -1 ENOENT (No such file or directory)
18:18:02 open("/etc/ssh/ssh_known_hosts", O_RDONLY) = -1 ENOENT (No such file or directory)
18:18:02 open("/dev/tty", O_RDWR)       = 4
18:18:02 close(4)                       = 0
18:18:02 open("/dev/tty", O_RDWR)       = 4


加载中
1
铂金胖子
铂金胖子
慢的机器看一下: /etc/resolv.conf 的配置
1
_
_Yud
在hosts文件中添加你的主机ip对应的名称可以闪速连接.
1
有毒的菜鸟
有毒的菜鸟
使用密钥试试,我前面也有点慢,后来使用密钥后,连接很快。
0
tinshen
tinshen
慢的机器 请查一下dns。
0
当朝宰相
当朝宰相
注释掉这个配置UseDNS yes
返回顶部
顶部