PowerDNS is a leading provider of secure open-source and commercial DNS software. PowerDNS solutions are focused on large-scale DNS service providers, including mobile and fixed-line broadband operators, and hosting and cloud service providers. PowerDNS also underpins scalable security solutions from market-leading vendors.

Providers trust PowerDNS to deliver an excellent user experience and protection against DDoS and malware attacks, as well as ensuring internet performance for Hosters and ISPs.

Setting up an authoritative PowerDNS server involves several steps. Below is a detailed guide on how to install and configure PowerDNS as an authoritative server on a Linux system, such as Ubuntu.

Step 1: Update Your System

Before installing any new software, ensure your system is up to date:

sudo apt update
sudo apt upgrade -y

Step 2: Install PowerDNS and Backend

PowerDNS supports multiple backends (e.g., MySQL, PostgreSQL, SQLite, etc.). For this guide, we’ll use the MySQL backend.

  1. Install PowerDNS and MySQL Backend:
   sudo apt install pdns-server pdns-backend-mysql
  1. Install MySQL Server:
    If MySQL server is not already installed, install it:
   sudo apt install mysql-server

Step 3: Configure MySQL for PowerDNS

  1. Secure MySQL Installation:
   sudo mysql_secure_installation
  1. Log in to MySQL:
   sudo mysql -u root -p
  1. Create PowerDNS Database and User:
   CREATE DATABASE powerdns;
   CREATE USER 'pdns'@'localhost' IDENTIFIED BY 'yourpassword';
   GRANT ALL PRIVILEGES ON powerdns.* TO 'pdns'@'localhost';
   FLUSH PRIVILEGES;
   EXIT;
  1. Create PowerDNS Tables:
    Download the PowerDNS schema and import it into the database:
   curl -O https://raw.githubusercontent.com/PowerDNS/pdns/master/modules/gmysqlbackend/schema.sql
   mysql -u pdns -p powerdns < schema.sql

Step 4: Configure PowerDNS

  1. Edit the PowerDNS Configuration File:
    Open /etc/powerdns/pdns.conf in a text editor:
   sudo nano /etc/powerdns/pdns.conf
  1. Set the MySQL Backend Configuration:
    Add the following lines, replacing yourpassword with the password you set for the pdns MySQL user:
   launch=gmysql
   gmysql-host=127.0.0.1
   gmysql-user=pdns
   gmysql-password=yourpassword
   gmysql-dbname=powerdns

Step 5: Start and Enable PowerDNS

  1. Start PowerDNS Service:
   sudo systemctl start pdns
  1. Enable PowerDNS to Start on Boot:
   sudo systemctl enable pdns

Step 6: Verify PowerDNS Operation

  1. Check the Status of PowerDNS:
   sudo systemctl status pdns
  1. Test PowerDNS:
    You can use the dig command to test if PowerDNS is working correctly. For example:
   dig @localhost example.com

Step 7: Adding Zones and Records

  1. Log in to MySQL:
   mysql -u pdns -p powerdns
  1. Add a Zone:
   INSERT INTO domains (name, type) VALUES ('example.com', 'NATIVE');
  1. Add DNS Records:
   INSERT INTO records (domain_id, name, type, content, ttl) VALUES ((SELECT id FROM domains WHERE name='example.com'), 'example.com', 'SOA', 'ns1.example.com hostmaster.example.com 1 10800 3600 604800 3600', 86400);
   INSERT INTO records (domain_id, name, type, content, ttl) VALUES ((SELECT id FROM domains WHERE name='example.com'), 'example.com', 'NS', 'ns1.example.com', 86400);
   INSERT INTO records (domain_id, name, type, content, ttl) VALUES ((SELECT id FROM domains WHERE name='example.com'), 'example.com', 'A', '192.0.2.1', 86400);
   INSERT INTO records (domain_id, name, type, content, ttl) VALUES ((SELECT id FROM domains WHERE name='example.com'), 'www.example.com', 'A', '192.0.2.2', 86400);

That’s it! You have now set up an authoritative PowerDNS server with a MySQL backend. Ensure that your firewall settings allow traffic on port 53 (both TCP and UDP) to your DNS server.

Setup PowerDNS Authoritative Sever

Post navigation