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

I rent some Linux servers and the hosting company provides a set of eight DNS resolvers.

The response speed varies from resolver to resolver and I periodically modify /etc/resolv.conf to get the best performance.

On two occasions I found one of my public websites was taking far too long to load and this was, in part, related to it depending on backend web services that were taking around 15s to resolve a domain to an IP.

To ensure the most responsive resolvers are always specified, I'd like to automate the process of modifying /etc/resolv.conf.

I can script it if need be, however that would inevitably feature an obscure bug and I want to minimise the risk of an automated process making a mess of /etc/resolv.conf. Any pre-existing solution that has been tested for a long time and shown to be stable will be more reliable than my own solution.

I'm interested in knowing if anyone has tackled this type of problem before and whether there are any stable scripts/processes/methods for handling this.

share|improve this question
up vote 2 down vote accepted

Have you tried installing your own local caching named? Install BIND locally (caching only), and then let it query the DNS the way it was meant to (find delegations dynamically based on delegations). The just change resolv.conf to point to and be done with it. Maybe throw one of your hosts IPs in there as a backup, but mostly rely on your own resolver.

share|improve this answer
Why BIND? Why not, for instance, Unbound ? – bortzmeyer May 25 '09 at 6:58
The local-caching part was the important bit. While I personally would install BIND out of habit and experience, I think any locally installed name server would work fine... – jj33 May 26 '09 at 0:42

On Debian based systems there is a package resolvconf (wiki) that is designed to handle updating of the resolv.conf.

You can append, or delete entries. You can setup scripts that will be called whenever an update has happened. This allows you to notify other services that an update has been made.

share|improve this answer

It would involve installing an extra server but you could use a centralised configuration management system such as cfengine or puppet to push out new resolv.conf to your server(s) Brett

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.