This is an old revision of the document!
http://www.misdivision.com/blog/create-your-own-dynamic-dns-service-using-powerdns-and-mysql
http://gnudip2.sourceforge.net
Here we provide a dynamic DNS service using PowerDNS and MySQL.
Here we install the packages and set the MySQL root password. Adjust as necessary:
yum install pdns pdns-backend-mysql mysql-server vim-enhanced chkconfig mysqld on service mysqld start mysqladmin -u root password 'new-password' mysqladmin -u root -h <your-server-fqdn> password 'new-password'
Now we log in to MySQL:
mysql -u root -p
Now, at the MySQL prompt, we configure MySQL permissions. Adjust as necessary:
CREATE DATABASE powerdns; GRANT ALL ON powerdns.* TO 'power_admin'@'localhost' IDENTIFIED BY 'power_admin_password'; GRANT ALL ON powerdns.* TO 'power_admin'@'<your-server-fqdn>' IDENTIFIED BY 'power_admin_password'; FLUSH PRIVILEGES;
Now we create the database:
USE powerdns; CREATE TABLE domains ( id INT auto_increment, name VARCHAR(255) NOT NULL, master VARCHAR(128) DEFAULT NULL, last_check INT DEFAULT NULL, type VARCHAR(6) NOT NULL, notified_serial INT DEFAULT NULL, account VARCHAR(40) DEFAULT NULL, primary key (id) ); CREATE UNIQUE INDEX name_index ON domains(name); CREATE TABLE records ( id INT auto_increment, domain_id INT DEFAULT NULL, name VARCHAR(255) DEFAULT NULL, type VARCHAR(6) DEFAULT NULL, content VARCHAR(255) DEFAULT NULL, ttl INT DEFAULT NULL, prio INT DEFAULT NULL, change_date INT DEFAULT NULL, primary key(id) ); CREATE INDEX rec_name_index ON records(name); CREATE INDEX nametype_index ON records(name,type); CREATE INDEX domain_id ON records(domain_id); CREATE TABLE supermasters ( ip VARCHAR(25) NOT NULL, nameserver VARCHAR(255) NOT NULL, account VARCHAR(40) DEFAULT NULL ); quit;
vim /etc/pdns/pdns.conf
Add the following lines to 'Launch' section of pdns.conf:
################################# # launch Which backends to launch and order to query them in # # launch= launch=gmysql gmysql-host=127.0.0.1 gmysql-user=power_admin gmysql-password=power_admin_password gmysql-dbname=powerdns