3

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.

Jon Cram
  • 309
  • 1
  • 4
  • 10

3 Answers3

2

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.

Zoredache
  • 130,897
  • 41
  • 276
  • 420
2

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 127.0.0.1 and be done with it. Maybe throw one of your hosts IPs in there as a backup, but mostly rely on your own resolver.

jj33
  • 11,178
  • 1
  • 37
  • 50
  • Why BIND? Why not, for instance, Unbound http://www.unbound.net/ ? – bortzmeyer May 25 '09 at 06: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 00:42
0

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