PowerDNS
PowerDNS is a DNS server designed to work with a database backend. Unlike BIND9 uses SDS driver to talk to a database engine, PowerDNS can use MySQL or even BIND as its backend. My two cents, using text file to store DNS is really stupid. By using a DBMS instead, data can be validated, and records can be edited by multiple users without need to reload the "zone files". Who think of the concept of zone files anyway.BTW, I tried using mysql-bind (patching Bind with MySQL SDS driver) before testing PowerDNS. mysql-bind requires editing bind9's source files, which is quite stupid. And somehow, it just doesn't fucking work. Bind started with an error saying zone create failure or something. mysql-bind's site: http://mysql-bind.sourceforge.net
Installation
It's pretty easy to follow: http://downloads.powerdns.com/documentation/html/configuring-db-connection.htmlI did an installation on Fedore Core 7 using the RPM file from the above site.
Initial configuration
Edit /etc/powerdns/pdns.conf and enter some basic stuff. For me, this is my config file:pdns.conf
config-dir=/etc/powerdns
launch=gmysql
gmysql-user=pdnsusr
gmysql-dbname=pdns
gmysql-socket=/var/lib/mysql/mysql.sock
# OR # gmysql-host=127.0.0.1
local-address=0.0.0.0
local-port=53
logfile=/var/log/pdns.log
socket-dir=/var/run
webserver=yes
webserver-address=0.0.0.0
webserver-password=powerdns
webserver-port=8081
# Recursion settings (forwarder)
allow-recursion=0.0.0.0/0
allow-recursion-override=no
lazy-recursion=yes
recursive-cache-ttl=10
recursor=192.168.13.254
launch=gmysql
gmysql-user=pdnsusr
gmysql-dbname=pdns
gmysql-socket=/var/lib/mysql/mysql.sock
# OR # gmysql-host=127.0.0.1
local-address=0.0.0.0
local-port=53
logfile=/var/log/pdns.log
socket-dir=/var/run
webserver=yes
webserver-address=0.0.0.0
webserver-password=powerdns
webserver-port=8081
# Recursion settings (forwarder)
allow-recursion=0.0.0.0/0
allow-recursion-override=no
lazy-recursion=yes
recursive-cache-ttl=10
recursor=192.168.13.254
Creating a database
I created a database called pdns on my mysql. Follow the installation to create the schema.Creating a domain and insert records
INSERT INTO domains (name, type) VALUES ('myplace.home', 'NATIVE');
INSERT INTO records (domain_id, name, content, type,ttl,prio) VALUES (1,'myplace.home','ns1.myplace.home dns@myplace.home 200706130 86400 7200 3600000 86400','SOA',86400,NULL);
INSERT INTO records (domain_id, name, content, type,ttl,prio) VALUES (1,'myplace.home','ns1.myplace.home','NS',86400,NULL);
INSERT INTO records (domain_id, name, content, type,ttl,prio) VALUES (1,'myplace.home','192.168.18.183','A',120,NULL);
INSERT INTO records (domain_id, name, content, type,ttl,prio) VALUES (1,'kenhp.myplace.home','192.168.18.183','A',120,NULL);
INSERT INTO records (domain_id, name, content, type,ttl,prio) VALUES (1,'myplace.home','mail.myplace.home','MX',120,50);
INSERT INTO domains (name,type) VALUES ('18.168.192.in-addr.arpa','NATIVE');
INSERT INTO records (domain_id,name,type,content) VALUES (2,'188.18.168.192.in-addr.arpa','PTR','server.myplace.home');
INSERT INTO records (domain_id, name, content, type,ttl,prio) VALUES (1,'myplace.home','ns1.myplace.home dns@myplace.home 200706130 86400 7200 3600000 86400','SOA',86400,NULL);
INSERT INTO records (domain_id, name, content, type,ttl,prio) VALUES (1,'myplace.home','ns1.myplace.home','NS',86400,NULL);
INSERT INTO records (domain_id, name, content, type,ttl,prio) VALUES (1,'myplace.home','192.168.18.183','A',120,NULL);
INSERT INTO records (domain_id, name, content, type,ttl,prio) VALUES (1,'kenhp.myplace.home','192.168.18.183','A',120,NULL);
INSERT INTO records (domain_id, name, content, type,ttl,prio) VALUES (1,'myplace.home','mail.myplace.home','MX',120,50);
INSERT INTO domains (name,type) VALUES ('18.168.192.in-addr.arpa','NATIVE');
INSERT INTO records (domain_id,name,type,content) VALUES (2,'188.18.168.192.in-addr.arpa','PTR','server.myplace.home');
Testing PowerDNS
My tests are not based on the records above. Just an illustration on what you will see.[root@kenhp ~]# host -t ANY myplace.home localhost Using domain server: Name: localhost Address: 127.0.0.1#53 Aliases: myplace.home mail is handled by 50 mail.myplace.home. myplace.home has SOA record ns1.myplace.home. hostnaster.myplace.home. 1 10800 3600 604800 3600 myplace.home name server ns1.myplace.home. myplace.home has address 192.168.18.183 [root@apop etc]# host www.linux.com localhost Using domain server: Name: localhost Address: 127.0.0.1#53 Aliases: www.linux.com has address 66.35.250.177 www.linux.com mail is handled by 10 mail.ostg.com.
PowerDNS recursor
If you simply need a recursive dns server (a caching server), powerdns-recursor seems to be a good choice. Get it from http://www.powerdns.com/content/downloads.aspx then create a config. The following is a very simply config file which enables caching on the public IP, and forward a certain domain to local authoritative server./etc/powerdns/recursor.conf
aaaa-additional-processing=off
allow-from=127.0.0.0/8, 192.168.13.0/24
forward-zones=comme.ca=127.0.0.1
local-address=192.168.13.10
local-port=53
max-cache-entries=1000000
quiet=no
setgid=pdns
setuid=pdns
threads=8
allow-from=127.0.0.0/8, 192.168.13.0/24
forward-zones=comme.ca=127.0.0.1
local-address=192.168.13.10
local-port=53
max-cache-entries=1000000
quiet=no
setgid=pdns
setuid=pdns
threads=8
PowerDNS provides a very handy tool for you to check on its performance. Run rec_control get-all will give you all the performance stats.
Measure performance
So how does it perform? You can benchmark it with namebench http://code.google.com/p/namebench/ It generates a list of top URI and then perform lookup.# send 100 queries, run it for 2 times, start 50 threads, and test only the name servers specified as arguments ./namebench.py -r2 -J10 -q100 -x -O 192.168.18.12 192.168.18.13
There are 39 comments on this page. [Display comments]