Goodbye Bind9: A Guide to Installing PowerDNS and PowerDNS-Admin for Web UI Management

Network tutorial - IT technology blog
Network tutorial - IT technology blog

Why PowerDNS is the Perfect Alternative to Bind9

If you’ve ever managed DNS with Bind9, you’re likely familiar with the “cold sweat” of editing zone files. A single extra dot or an incorrect serial number is enough to bring down the entire system. I once managed a small datacenter with over 200 DNS records. Manually typing commands for every minor change was a nightmare for both efficiency and accuracy.

That’s why I switched to PowerDNS. Instead of storing data in error-prone flat text files, PowerDNS manages everything through a Database (MariaDB, PostgreSQL). When combined with PowerDNS-Admin, you get an enterprise-grade dashboard. The system supports Role-Based Access Control (RBAC), change history logging, and provides a powerful API for CI/CD integration or automating Let’s Encrypt certificates via DNS-01 challenges.

Three Core Components You Need to Know

Before running any commands, let’s distinguish between these components to avoid configuration confusion:

  • PowerDNS Authoritative Server: The heart of the system. It answers DNS queries from the internet for domains you own. Note: It does not look up IPs for google.com (that’s the job of the Recursor).
  • PowerDNS-Admin: A Web interface written in Flask. It acts as the control layer, communicating with the server via an API.
  • Backend (MariaDB): The centralized data store for all DNS records.

Detailed Installation on Ubuntu 22.04/24.04

Step 1: Freeing Up Port 53

A classic error that prevents PowerDNS from starting is a port conflict. Ubuntu uses systemd-resolved by default, which occupies port 53. You need to disable it immediately.

# Stop the default service
sudo systemctl disable --now systemd-resolved

# Configure temporary DNS so the server can still download packages
sudo rm /etc/resolv.conf
echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf

Step 2: Installing MariaDB and Initializing the Database

A stable database is a prerequisite. We will create a dedicated space for PowerDNS.

sudo apt update && sudo apt install mariadb-server -y

# Create database and user
sudo mysql -u root
CREATE DATABASE powerdns;
GRANT ALL ON powerdns.* TO 'pdns_user'@'localhost' IDENTIFIED BY 'SuperSecurePassword';
FLUSH PRIVILEGES;
EXIT;

Step 3: Installing PowerDNS Authoritative Server

Install the server package along with the MySQL backend so the system can read data from MariaDB.

sudo apt install pdns-server pdns-backend-mysql -y

Next, load the table structure (schema) into the database. This file is usually located in the documentation directory of the installation package.

sudo zcat /usr/share/doc/pdns-backend-mysql/schema.mysql.sql.gz | mariadb -u pdns_user -p powerdns

Step 4: Configuring Database Connection and API

Open the /etc/powerdns/pdns.conf file. Clear it or comment out the old lines, then paste the configuration below. Make sure to update the IP and API Key according to your environment.

# Use MySQL backend
launch=gmysql
gmysql-host=127.0.0.1
gmysql-user=pdns_user
gmysql-password=SuperSecurePassword
gmysql-dbname=powerdns

# Enable API for PowerDNS-Admin
api=yes
api-key=YourChosenKey123
webserver=yes
webserver-address=0.0.0.0
webserver-allow-from=127.0.0.1,192.168.1.0/24

Restart to apply the new configuration:

sudo systemctl restart pdns
sudo systemctl enable pdns

Step 5: Deploying PowerDNS-Admin with Docker

Installing PowerDNS-Admin manually via Python venv can be a headache due to library conflicts. The best solution is to use Docker Compose to deploy it in 30 seconds.

version: '3'
services:
  pdns-admin:
    image: powerdnsadmin/pda-legacy:latest
    container_name: pdns-admin
    ports:
      - "8080:80"
    environment:
      - SQLALCHEMY_DATABASE_URI=mysql+pymysql://pdns_user:[email protected]/powerdns
      - GUNICORN_TIMEOUT=60

Note: 172.17.0.1 is typically the host machine’s IP as seen from inside the Docker container.

Testing and Real-world Operation

After accessing http://Server-IP:8080 and creating an account, follow these steps:

  1. API Connection: Go to Settings -> PDNS, enter the URL http://127.0.0.1:8081 and the API Key you created.
  2. Resolution Test: Create a test zone lab.local and an A record. Use the command dig @localhost -t A test.lab.local to check. If it returns the correct IP, the system is running perfectly.

Hard-won Lessons for DNS Operation

Don’t wait until data loss occurs to regret it. Here are the 3 most important considerations:

  • Automated DB Backups: If DNS dies, all services die. Set up mysqldump to run nightly and push the backup files to a different server.
  • API Security: Never expose port 8081 to the internet. Only allow localhost or the Admin server’s IP via a Firewall (UFW/Iptables).
  • High Availability (HA): For critical systems, run two PowerDNS nodes. Use MariaDB Replication to synchronize record data instantly between the two servers.

Switching to PowerDNS not only saves you from typing commands but also professionalizes your network infrastructure management. Good luck with your deployment, and may you have peaceful nights without DNS worries!

Share: