PowerDNS Part 2 – Slave Server Installation (Ubuntu)

In this post, I will cover the installation of PowerDNS Authoritative server (Part 2 of 3).

Requirements: Port 53 must be open between the master and slave servers.

Install Mariadb & start mysql_secure_installation.

sudo apt install mariadb-server
sudo mysql_secure_installation

Create the database & database user. Replace YourPassword with a strong password!

mysql -u root -p
CREATE DATABASE powerdns;
GRANT ALL ON powerdns.* TO 'powerdns_dbuser'@'localhost' IDENTIFIED BY 'YourPassword';
FLUSH PRIVILEGES;

Add the master server. Replace 1.2.3.4 with the IP address from your master server.

USE powerdns;
INSERT INTO supermasters (ip, nameserver, account) VALUES ('1.2.3.4', 'ns2.yourdomain.com', 'admin');

Check the master server(s).

SELECT * FROM supermasters;

Choose the version (same version as your master) for your distro & follow the steps from PDNS to add the repo. https://repo.powerdns.com/

Install pdns-server and pdns-backend-mysql.

apt install pdns-server pdns-backend-mysql

Download & import the schema.

mysql -u powerdns_dbuser -p powerdns < /usr/share/pdns-backend-mysql/schema/schema.mysql.sql

Create the MySQL config:

nano /etc/powerdns/pdns.d/pdns.local.gmysql.conf

Replace YourPassword & paste it in pdns.local.gmysql.conf.

launch=gmysql
gmysql-host=localhost
gmysql-dbname=powerdns
gmysql-user=powerdns_dbuser
gmysql-password=YourPassword
gmysql-dnssec=yes

Edit the PDNS configuration file.

nano /etc/powerdns/pdns.conf

Check & edit the following values.

allow-notify-from
include-dir
local-address
query-local-address
server-id
master
superslave

Example:

(Replace 1.2.3.4 with the IP address from your master server & 2.3.4.5 with the IP address from the slave)
allow-notify-from=1.2.3.4
include-dir=/etc/powerdns/pdns.d
local-address=2.3.4.5
query-local-address=2.3.4.5
server-id=ns2.yourdomain.com
master=no
superslave=yes

Restart powerdns.

systemctl restart pdns
systemctl enable pdns

Check the status.

systemctl status pdns

The PowerDNS Slave has been successfully installed and configured.

Leave a Comment