Monday, July 9, 2012

SSH is slow to make a connection

SSH is slow to make a connection


I just installed RHEL 6.2, and whenever I try to SSH into my servers it's very slow. Before it displays the password prompt, it can take between 40 seconds and 60 seconds.

I found the solution of it.
This is slow because the OpenSSH daemon uses DNS to run a reverse lookup on the client hostname to make sure it's valid.
sudo vi /etc/ssh/ssh_config
 
Comment out the following lines 
#GSSAPIAuthentication yes
#GSSAPIDelegateCredentials no
 
OR

add this:

UseDNS no
 
Restart sshd deamon