Smokes your problems, coughs fresh air.

Configuring a Power DNS superslave server

Power DNS, as opposed to Bind, has the option to be a superslave. This means that it will initiate any zone transfer from trusted hosts, avoiding the need to configure each zone on both master and slave.

Power DNS has separate back-ends, of which you must choose one. I chose mysql, and I use the generic mysql engine (this is different, and better, than normal MySQL, or something like that…).

First install Power DNS:

aptitute -P install pdns-server pdns-backend-mysql

Then create a database and user:

create database pdns character set utf8;
grant all on pdns.* to 'pdns'@'localhost' identified by 'password';

Then create this schema (found it in the Power DNS docs):

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)                                                                                                                                        
)type=InnoDB;                                                                                                                                            
                                                                                                                                                         
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),
  CONSTRAINT `records_ibfk_1` FOREIGN KEY (`domain_id`) REFERENCES `domains` (`id`) ON DELETE CASCADE
)type=InnoDB;
 
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
);
 
GRANT SELECT ON supermasters TO pdns;
GRANT ALL ON domains TO pdns;
GRANT ALL ON records TO pdns;

Then create /etc/powerdns/pdns.d/pdns-mysql-backend with this in it:

launch=gmysql
gmysql-host=127.0.0.1
gmysql-user=pdns
gmysql-password=password
gmysql-dbname=pdns

Then insert a supermaster:

insert into supermasters values ('1.2.3.4','ns1.example.com','identifiername');

Lastly, don’t forget to enable slave mode in /etc/powerdns/pdns.conf:

slave=yes

1 Comment

  1. halfgaar

    As commented by the back track, newer versions of powerdns don’t need the manual step anymore. However, they do need some SQL.

© 2024 BigSmoke

Theme by Anders NorenUp ↑