Improving DNS Lookups on Linux

  • 17 Oct, 2017

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.

Related Posts

Error when run dnf install rpm-build

  • 31 Mar, 2025

I was installing the IBM MQ Server on a linux box yesterday. I got the error bellow: \root@gateway MQServer\ dnf install rpm-build
Updating Subscription Management repositories.
Instana 14 B/s |

Error when run dnf install rpm-buildRead More

How to Install watch on macOS Sequoia

  • 06 Feb, 2025

The watch command is a useful utility in Unix-like systems that allows you to execute a command periodically and display its output. However, macOS does not come with watch pre-installed. If you're ru

How to Install watch on macOS SequoiaRead More

rsync is faster than scp to copy files between machines

  • 31 Dec, 2024

rsync is generally faster than scp for copying files, especially when transferring a large amount of data or syncing directories. Here's why: 1. Incremental Transfers - rsync: Only transfers the p

rsync is faster than scp to copy files between machinesRead More