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

Currently I'm using the plain vanilla linux configuration for resolv.conf... something like:


When goes down DNS queries become impossible slow, I'm assuming that Linux retries the first one each time. Is there a way to get linux to be smarter about this? Health checks or something? Or do I misunderstand how resolv.conf should work?

share|improve this question
up vote 9 down vote accepted

This is described via man resolv.conf.

Please try one of the timeout options to lower the default from 5 seconds to perhaps 1 second...

options timeout:1

But really, DNS has so many resiliencies available, it's possible to live without lower resolution timeouts. Is it possible to pick better public DNS or run your own internal resolver?

share|improve this answer

In addition to ewwhite's awesome response, some addendum.

You can add this in /etc/resolv.conf

options timeout:1 attempts:1 rotate

The defaults are time:5 attempts:2

What happens is that the resolver library will try to use the nameservers listed in /etc/resolv.conf from top to bottom if no rotate option is present. If rotate is present, then it does a round-robin selection. If the resolver goes to the bottom of the list and the server doesn't respond within X seconds (considering X is the timeout parameter) then it will repeat the whole process of round robin selection again for Y-1 times (where Y is the value of attempts).

However a bit of caution would be to avoid dig and friends for testing these resolv.conf options. As they avoid resolver library and directly ask the nameservers. getent hosts is the better command to use. Note that anything that uses glibc resolver will have to obey /etc/resolv.conf file.

share|improve this answer

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.