lost and found ( for me ? )

install PowerDNS on CentOS6.4 64bit



# cat /etc/centos-release
CentOS release 6.4 (Final)
# uname -ri
2.6.32-358.2.1.el6.x86_64 x86_64

install epel repo to install pdns via yum.
# rpm -ivh http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm

install MySQL
# yum install -y mysql mysql-server

start MySQL
# /etc/init.d/mysqld start

creat a user
# mysqladmin -u root password passwd

install PowerDNS via yum
# yum install -y pdns pdns-backend-mysql

configure DB for powerDNS
# mysql -u root -p
mysql> CREATE DATABASE powerdns;

mysql> GRANT ALL ON powerdns.* TO 'pdns_admin'@'localhost' IDENTIFIED BY 'passwd';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL ON powerdns.* TO 'pdns_admin'@'localhost.localdomain' IDENTIFIED BY 'passwd';
Query OK, 0 rows affected (0.00 sec)

mysql>  FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql>  USE powerdns;
Database changed
mysql>  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 (
Query OK, 0 rows affected (0.05 sec)

mysql>  CREATE UNIQUE INDEX name_index ON domains(name);
id INT auto_increment,
domain_id INT DEFAULT NULL,
Query OK, 0 rows affected (0.03 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql>  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);
Query OK, 0 rows affected (0.03 sec)

mysql>  CREATE INDEX rec_name_index ON records(name);
CREATE INDEX domain_id ON records(domain_id);
Query OK, 0 rows affected (0.04 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql>  CREATE INDEX nametype_index ON records(name,type);
CREATE TABLE supermasters (
ip VARCHAR(25) NOT NULL,
nameserver VARCHAR(255) NOT NULL,
Query OK, 0 rows affected (0.03 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql>  CREATE INDEX domain_id ON records(domain_id);
account VARCHAR(40) DEFAULT NULL
);Query OK, 0 rows affected (0.04 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql>  CREATE TABLE supermasters (
   ->  ip VARCHAR(25) NOT NULL,
   ->  nameserver VARCHAR(255) NOT NULL,
   ->  account VARCHAR(40) DEFAULT NULL
   ->  );
Query OK, 0 rows affected (0.05 sec)

mysql> quit
Bye

configure pdns.conf
# egrep -v ^# /etc/pdns/pdns.conf | grep -v ^$
setuid=pdns
setgid=pdns
launch=gmysql
gmysql-host=127.0.0.1
gmysql-user=pdns_admin
gmysql-password=passwd
gmysql-dbname=powerdns
master=yes
out-of-zone-additional-processing=yes
slave=no

start pdns
# /etc/init.d/pdns restart
Restarting PowerDNS authoritative nameserver: stopping and waiting..done
Starting PowerDNS authoritative nameserver: started

convert bind config for powerDNS
# zone2sql --named-conf=/etc/named.conf --gmysql > zones.sql
100% done
6 domains were fully parsed, containing 4022 records

import zones.qsl into powerdns database.
# mysql -u root -p powerdns < zones.sql
Enter password:

# dig @127.1 www.foo.com

; <<>> DiG 9.9.2-vjs287.12 <<>> @127.1 www.foo.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 11057
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; WARNING: recursion requested but not available

;; QUESTION SECTION:
;www.foo.com.                   IN      A

;; ANSWER SECTION:
www.foo.com.            86400   IN      A       127.0.0.1

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.