Improving DNS Lookups on Linux


A good DNS service is very important for a mail server.

On Linux servers you need to put your DNS servers on a file called resolv.conf. In general you have two entries like this:


If one server does not respond then linux will try the second, but there is a timeout for this:

                     Sets the amount of time the resolver will wait for a
                     response from a remote name server before retrying the
                     query via a different name server. This may not be the
                     total time taken by any resolver API call and there is
                     no guarantee that a single resolver API call maps to a
                     single timeout.  Measured in seconds, the default is
                     RES_TIMEOUT (currently 5, see <resolv.h>).  The value
                     for this option is silently capped to 30.

If you want to speed this resolution change resolv.conf to:

options rotate
options timeout:1

Using the configuration above, both nameserver in rotation and wait max. 1 second for answer before trying the next one.