Improving DNS Lookups on Linux

Share

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:

nameserver1   192.168.10.10
nameserver2   10.10.1.1

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

timeout:n
                     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
nameserver1 192.168.10.10
nameserver2 10.10.1.1

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