ssh -v 192.168.1.138
然后会出现很多bug
例如:
debug1: Next authentication method: gssapi-keyexdebug1: No valid Key exchange contextdebug1: Next authentication method: gssapi-with-micdebug1: Unspecified GSS failure. Minor code may provide more informationCredentials cache file '/tmp/krb5cc_0' not founddebug1: Unspecified GSS failure. Minor code may provide more informationCredentials cache file '/tmp/krb5cc_0' not founddebug1: Unspecified GSS failure. Minor code may provide more informationdebug1: Unspecified GSS failure. Minor code may provide more informationCredentials cache file '/tmp/krb5cc_0' not founddebug1: Next authentication method: publickeydebug1: Trying private key: /root/.ssh/identity
查看一下连接时间:
time ssh root@192.168.1.138 exitreal0m4.785suser0m0.014ssys0m0.011s
1、关闭DNS反向解析
在linux中sshd 的服务里是默认开启DNS解析的。会消耗时间,所以需要关闭。
vim /etc/ssh/sshd_configUseDNS no
虽然是被注释掉的,但是默认是yes开启的。
time ssh root@192.168.1.138 exitreal0m3.978suser0m0.016ssys0m0.010s
看实际的连接时间明显减少了很多。说明起了作用!
2、关闭SERVER的认证
在authority过程中,gssapi-with-mic有可能出现很大问题,因此关闭gssapi可以提高很大的速度。
vim /etc/ssh/sshd_configGSSAPIAuthentication no
保存推出
time ssh root@192.168.1.138 exitreal 0m3.832suser 0m0.011ssys 0m0.004s
时间明显减少了很多。基本上就可以正常使用了。