In need of a MySQL backend for my DNS server, I have decided to switch from Bind to PowerDNS, the MySQL backend of which is slightly more convenient.

Basically : users add domains to my database using a web frontend, those domains are registered and available to PowerDNS. When I query the DNS server about these domains, I get a valid response. Works like a charm.

The fact is, I need to add domains and zones of mine to my DNS registries, and adding them to the database would break my application's logic (only users of this application should be adding domains). I would like to add extra domains and zones to PowerDNS, without adding them to my database directly.

Is there any way I could register additional domains, in a file for instance, which would be read before any MySQL query is made ? Or maybe a fallback file, in case nothing's found among my MySQL records ?


Solution found, in the depths of the PowerDNS launchpad ! There is a way to read DNS-data files before using the MySQL backend, and that is... using two backends ! Quoting :

As described in http://doc.powerdns.com/modules.html - just not with so many words ;) - PowerDNS can launch any number of different or oven the same backends via the launch statement. Usually one would just do that in the configuration file pdns.conf instead of the command line. Those backends will be exhausted for answers to your DNS query in the order in which they are given in the launch statement. This does mean that if your first backend in line can answer the question, it will and if only the fourth in line can answer the question you will have the delay of the looping through the first three backends until PowerDNS will send out the answer. It is therefore imperative that you make sure that your backends do answer fast enough where fast enough would be receiving and answer in <1s should be enough to be compatible with most recursive nameservers, however faster is better of course.

For my problem, I chose to use :

  • A Bind backend, which serves as the prioritary file-based backend.
  • The MySQL backend, which comes second.

Basically, all it takes is a little configuration change in pdns.local :


I've heard you could be even more specific with (assigns names to backends) :


Then, just add parameters for both backends :

# Bind backend configuration

# MySQL configuration

All you have to do is create a Bind zone file (zone{} blocks) referring to domain-specific files (containing SOA, A, MX, NS, ... records).

Restart !

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.