0

I'm looking to convert a Bind-DLZ based setup to a PowerDNS based setup. To do this, I would like to use the zone2sql tool that comes with PowerDNS. Sadly, this tool skips right over the DLZ defined zone in my named.conf. I have been searching for a script that will dump the DLZ database into traditional DNS files and a named.conf that references them, but have not had any luck.

Does such a tool exist? If so, would you be so kind as to link me to it?

James Sumners
  • 493
  • 3
  • 7
  • 17
  • Wouldn't it be possible to simply `AXFR` the zone contents out of there? – Håkan Lindqvist Jul 25 '14 at 16:02
  • I do not know. I'm relatively unfamiliar with Bind administration. Could you please elaborate? – James Sumners Jul 25 '14 at 16:18
  • My question is more about PowerDNS and the tools for it, as importing zone contents from `AXFR` seems more universal and cleaner than reading files. You can definitely get the zone contents from BIND (and most other nameservers) using `AXFR`, that is part of the standard zone transfer mechanism. An example: `dig @nameserver example.com AXFR`, provided `allow-transfer` permits this. I may have a closer look at things on the PowerDNS side but atm I don't feel I can write a proper answer. – Håkan Lindqvist Jul 25 '14 at 16:28

1 Answers1

2

The simplest method to extract the DNS information from the Bind-DLZ database is to use an AXFR query for each "zone" in the database.

First, determine the zones stored in your database by connecting to it with whichever client is appropriate for your database type (e.g. mysql) and issuing the statement:

SELECT DISTINCT zone FROM dns_records;

Where the dns_records table is the table that houses your DNS information.

Second, make sure the Bind server allows transfer requests from the host where you will be performing the extract. Edit your named.conf and adjust your options block accordingly (then restart Bind):

options {
  # Allow host 192.168.1.5 to issue AXFR queries to this server
  allow-transfer { 192.168.1.5; };
};

Third, for each zone in the list retrieved from your DLZ database, issue the following command:

$ dig AXFR @your-dns-server.example.com a.zone.com > a.zone.com.zonefile

Where "a.zone.com" is a zone from the list (e.g. "example.com"), and "a.zone.com.zonefile" is a file that will be created with the zone's entries.

Finally, use the zone2sql tool to convert each of your zone files for the PowerDNS database.

James Sumners
  • 493
  • 3
  • 7
  • 17