Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a very interesting situation. I have a server running CentOS5.5, and whenever I try to ssh in using any external interface, there is a 4+ second delay, consistently. There is no such delay whenever I use the internal interfaces. For example, ssh'ing into mycomputer1 from mycomputer2 has little delay, but ssh'ing into from mycomputer2 goes to the external interface, where the lag occurs. /var/log/messages shows this when logging in with a password, with some redactions:

Mar 18 10:18:06 somecomputer sshd[788]: pam_unix(sshd:auth): authentication failure; 
Mar 18 10:18:06 somecomputer sshd[788]: pam_krb5[788]: TGT verified using key for ...
Mar 18 10:18:06 somecomputer sshd[788]: pam_krb5[788]: authentication succeeds for user
Mar 18 10:18:12 somecomputer sshd[788]: Accepted password for user from computer port myport ssh2
Mar 18 10:18:13 somecomputer sshd[788]: pam_unix(sshd:session): session opened for user myuser by (uid=0)

Here's /etc/pam.d/sshd:

auth       include      system-auth
account    required
account    include      system-auth
password   include      system-auth
session    optional force revoke
session    include      system-auth
session    required
session    required

Here's system-auth:

auth        required
auth        sufficient likeauth nullok
auth        sufficient use_first_pass
auth        required

account     required broken_shadow
account     sufficient uid < 100 quiet
account     [default=bad success=ok user_unknown=ignore]
account     required

password    requisite retry=3
password    sufficient use_authtok
password    sufficient nullok use_authtok md5 shadow
password    required

session     required
session     required
session     required use_first_pass
share|improve this question
up vote 1 down vote accepted

It's a DNS issue, add UseDNS no into /etc/ssh/sshd_config, reload ssh and see if changes.

share|improve this answer
Thanks for the tip, but it appears to have done nothing at all. I too thought it was a DNS issue at first, but it appears to be something more sinister. Can you think of any other information I could provide to make it more clear? – jyaworski Mar 18 '13 at 15:05
Could there be any other component that uses DNS lookups? When you have a 4 to 5 second consistent pause, it's pretty much the standard DNS lookup timeout.. what if you add a line for computer in /etc/hosts? – NickW Mar 18 '13 at 15:09
To help determine if name resolution is a problem: when you ssh into, run who --ips to find the IP of mycomputer2 (or whatever it eventually got NATed to) and then run getent hosts <IP>. If there is a pause then name resolution is an issue. – Mark Wagner Mar 18 '13 at 16:56
Actually, it appears that there's some kind of DNS lookup somewhere in the process. If I add into the hosts file for computer1 and then ssh to from computer1, it goes instantly without a delay. Time to look into why this nameserver is so slow. I'll mark this as solved. Thanks for the assistance. It was most puzzling. – jyaworski Mar 18 '13 at 17:14
Yeah, it's one of the reasons I always run an internal DNS server, or at least a caching server, DNS has it's tentacles in lots of things you wouldn't expect :) – NickW Mar 18 '13 at 17:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.