PowerDNS and importing from Bind to MySQL

Configure PowerDNS, Poweradmin, and a MySQL backend

PowerDNS is a useful tool with a web interface (Poweradmin) that can make your DNS management easier. This document is to assist with the conversion process from bind’s named.conf file format.

First, tar and copy to the new server your named.conf and all included zone files from /var/lib/named, /etc/bind, or wherever your distro saves your zone files. In this example, the conf and zone files were copied into local folder ‘namedfiles.’ Modify the path specified in the named.conf to point to this local folder.

Next, create your zones manually in Poweradmin. Let’s assume the MySQL database name is powerdns.¬† Go into mysql and identify the domain_id/id for each:

mysql -u poweradmin -p powerdns
select * from domains;

Next, prepare zone2sql options for conversion. You will want to specify the start-id number.

zone2sql --mysql --named-conf=namedfiles/named.conf.local --verbose \
--start-id=9 > import.sql

Examine your import.sql file and make any necessary changes, such as replacing the new SOA name servers.

Finally, import the sql:

mysql -u poweradmin -p powerdns < import.sql

You should now see the domains and records populated in Poweradmin.

Useful links:

http://blog.nachtarbeiter.net/tag/pdns/

http://downloads.powerdns.com/documentation/html/index.html

Installing PowerDNS

Download the RPM’s if available; SuSE/SLES has them available on th SuSE Build Service for 32 or 64 bit platforms.

pdns-x.x.x.rpm, pdns-mysql-backend-x.x.x.rpm, pdns-recursor-x.x.x.rpm

Edit your /etc/pdns/pdns.conf file with these parameters:

recursor, range of allowed addresses  (more to come here later)

Set powerdns to start at boot with: chkconfig on pdns

Test with: nslookup servername @dnsserver  and it should come back with a quick reply.

Install PowerAdmin, the apache tool to allow easy management of DNS IP addresses. Requires PHP.

Set up MySQL replication so your primary server updates the secondary DNS server. See the “Perfect Setup” how-to document available on the web.

Advertisements