If you’re experiencing slow logins via SSH on a Red Hat Enterprise 6 or CentOS 6 system, it’s probably caused by DNS that is taking too long to respond. Even with correct nameservers in /etc/resolv.conf, you may still find yourself stuck with slow logins.
The solution is to add the following line to your /etc/resolv.conf. Just add it all the way at the bottom, as the last line.
options single-request-reopen
That should fix your slow SSH logins, given you have valid and fast-responding nameservers in your /etc/resolv.conf.