SSH and sudo were starting very slowly because /etc/hostname and /etc/hosts did not match. After adding a line for the hostname in the hosts file, the initial 2-4 second delay no longer occurs.

At first I was surpised the mis-configured hosts file caused delays with SSH and sudo. I was SSH'ing to the server with a direct IP address, and sudo did not seem to require a hostname lookup. However, I read they were both doing reverse DNS lookups. (sudo also helpfully reported it was unable to resolve the host)

What other network operations will be slowed down by such a mis-configured hosts file? For example, could a mis-configured hosts file slow down connections to an Apache Tomcat server with Spring hosted on that server?

  • ping. It does a reverse DNS lookup for each packet. – Matt Simmons Dec 30 '11 at 3:51

Anything performing a reverse DNS lookup will be slowed down only if you are lucky, rest of the time they'll create a havoc. Ping and traceroute will behave funny. If you are running a mail server then there is a high probability that your mails will be treated as spam by gmail and other reputed providers.

Basically it is your trust rating which you are compromising.


Were your DNS servers correct in /etc/resolv.conf? If so, this shouldn't really have had any major effect. If your DNS servers were also broken, this could result in significant delays as software waiting for the timeout for DNS queries.

  • There is a working nameserver listed in /etc/resolv.conf, but I forgot to mention the folks here like to change the hostname without actually registering it in DNS. – Leftium Dec 30 '11 at 3:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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