What is PowerDNS?
PowerDNS is an open-source DNS (Domain Name System) server software that provides both authoritative and recursive DNS services. It’s widely used by ISPs, hosting providers, and enterprises due to its performance, scalability, and flexibility.
Key Features of PowerDNS:
- Authoritative Server:
- Serves DNS records for domains.
- Supports a wide range of backends: MySQL, PostgreSQL, SQLite, LDAP, and more.
- Ideal for dynamic DNS environments and large-scale deployments.
- Recursor (Recursive DNS Server):
- Handles DNS lookups for client systems.
- Focused on speed and security.
- Can be used standalone or alongside the authoritative server.
- High Performance:
- Known for its efficient query handling.
- Suitable for handling millions of queries per second.
- Extensible:
- Built-in Lua scripting support for custom behavior.
- APIs for automation and integration.
- DNSSEC Support:
- Provides tools for signing zones and validating queries.
- Web-based and API Management:
- Integration with tools like PowerDNS-Admin for user-friendly DNS management.
Common Use Cases:
- Hosting companies managing customer DNS zones.
- Enterprises with complex internal DNS setups.
- Service providers needing a scalable DNS solution.
How to Deploy PowerDNS Cluster on Ubuntu VPS Servers
This setup will use:
- PowerDNS Authoritative Server with a MySQL backend
- Multiple VPS nodes: one primary (master), one or more secondaries (slaves)
- Optional: Web-based interface like Poweradmin for easier DNS management
✅ Prerequisites
Before starting, make sure:
- You’re using Ubuntu 22.04 or newer
- You have at least 2 VPS servers (more if you want a larger cluster)
- You have root or sudo access on all servers
- You’ve set up static IPs and hostnames
- You have MySQL (or MariaDB) installed
- Ports 53 (UDP/TCP) and 3306 (TCP) are open between nodes
⚙️ Overview of Architecture
- Primary DNS Server (Master): Handles zone creation and updates
- Secondary DNS Servers (Slaves): Pull zone data from master using AXFR
- MySQL Database: Central backend for zone records (can be replicated if needed)
🛠 Step-by-Step Deployment
To deploy PowerDNS cluster on Ubuntu VPS servers, follow the steps provided below:
-
Install PowerDNS and MySQL on the Master
sudo apt update sudo apt install pdns-server pdns-backend-mysql mariadb-server -y
-
Secure MySQL and Create PowerDNS Database
sudo mysql_secure_installation
Then log into MySQL:
sudo mysql -u root -p
Run these SQL commands:
CREATE DATABASE powerdns; GRANT ALL ON powerdns.* TO 'pdns'@'localhost' IDENTIFIED BY 'StrongPasswordHere'; FLUSH PRIVILEGES; EXIT;
-
Import PowerDNS Schema
Download schema:
wget https://raw.githubusercontent.com/PowerDNS/pdns/master/modules/gmysqlbackend/schema/schema.mysql.sql
Import it:
mysql -u pdns -p powerdns < schema.mysql.sql
-
Configure PowerDNS to Use MySQL
Edit PowerDNS config:
sudo nano /etc/powerdns/pdns.conf
Add/modify:
launch=gmysql gmysql-host=127.0.0.1 gmysql-user=pdns gmysql-password=StrongPasswordHere gmysql-dbname=powerdns
Restart PowerDNS:
sudo systemctl restart pdns
-
Add Zones and Records (Master)
You can insert zones manually into the database or use Poweradmin (optional, covered later).
Example to add a zone:
INSERT INTO domains (name, type) VALUES ('example.com', 'MASTER');
-
Set Up Secondary DNS Server (Slave)
-
Install PowerDNS
sudo apt update sudo apt install pdns-server pdns-backend-bind -y
-
Configure PowerDNS as a Slave
Edit
/etc/powerdns/pdns.conf
:launch=bind bind-config=/etc/powerdns/named.conf
Create
/etc/powerdns/named.conf
:sudo nano /etc/powerdns/named.conf
Example slave zone:
zone "example.com" { type slave; masters { MASTER_IP; }; file "example.com.zone"; };
Restart PowerDNS:
sudo systemctl restart pdns
-
-
Allow Zone Transfers on Master
In your MySQL database, set
also_notify
andallow_notify_from_master
if needed.Or manually allow AXFR in
pdns.conf
:allow-axfr-ips=SLAVE_IP also-notify=SLAVE_IP
Restart the master PowerDNS:
sudo systemctl restart pdns
-
Install Poweradmin on Master
-
Install Apache and PHP
sudo apt install apache2 php php-mysql libapache2-mod-php unzip -y
-
Download Poweradmin
wget https://github.com/poweradmin/poweradmin/archive/master.zip unzip master.zip sudo mv poweradmin-master /var/www/html/poweradmin
-
Setup and configure in browser
Visit:
http://YOUR_MASTER_IP/poweradmin/install
Follow the steps and provide DB info. When done, delete the install directory.
-
🔍 Validation & Testing
- Use
dig @MASTER_IP example.com ANY
to query records - Use
dig @SLAVE_IP example.com AXFR
to test zone transfers - Check logs:
/var/log/syslog
orjournalctl -u pdns
🔐 Hardening Tips
- Enable UFW and limit to specific IPs
- Change default MySQL port if exposed
- Use secure passwords and disable remote root MySQL login
- Use DNSSEC (PowerDNS supports it)
✅ Summary
Component | Role |
---|---|
Master VPS | Authoritative DNS, MySQL backend |
Slave VPS | Secondary, pulls zones via AXFR |
MySQL | Stores DNS records |
Poweradmin | Web UI for DNS mgmt |
Conclusion
You now know how to deploy PowerDNS cluster on Ubuntu VPS servers.