Thanks to http://www.hackosis.com/2007/12/15/linux-fix-slow-ssh-login/
The Problem:
By default, most SSH installations are set to do a reverse DNS lookup on any incoming connections. If the DNS server times out, or there is no record for your IP address, it can result in a very lengthy delay when logging into your Linux server via SSH.
The Solution:
There are about 3 different solutions to this problem.
- Disable reverse lookup on the SSH server you are connecting to.Append
UseDNS no
UsePAM noto the /etc/ssh/sshd_config file on the server you are connecting to and restart the SSH daemon —
/etc/init.d/sshd restart or /etc/init.d/ssh restart.
- If you are connecting from a static IP, you may enter your host name in the /etc/hosts file.
- Call your ISP and ask them to setup reverse hostnames for customer’s IP addresses.
And enjoy your non-delay SSH login for more info check out the sshd_config man page.