VPSTutorial.com

VPS Tutorials for the masses!

PowerDNS

In this tutorial we will teach you how to setup an alternative DNS server called PowerDNS. It licensed under the GPL and can even be forked on Github. Unlike Bind, PowerDNS can be setup using a multitude of backends such as Bind Zone Files, or various Databases.

For this example we will setup PowerDNS using MySQL as the backend on CentOS 6. Additionally we will install, PowerAdmin which is a web based control panel for PowerDNS.

We will configure this server to support both Authoritative and Recursive queries. This will require 2 separate packages from PowerDNS as out of the box PowerDNS is Authoritative only. Luckily they also make a recursive server called PowerDNS Recursor that easily integrates with the Authoritative server.

You will need a VPS or Dedicated Server to run PowerDNS on. A good VPS for this purpose is ZoomCloud.net’s 1GB VPS. For only 19.99 a month you get a really fast DNS server that will serve you for years to come.

Prerequisites

First you need to install a few Prerequisites on your VPS or Dedicated Server before you can configure PowerDNS. You will need to install a web server like Apache, PHP modules, MySQL Server and Client.

You should also set Apache and MySQL to start on reboot.

Setup Database for PowerDNS

First you need to start the MySQL server.

Next you need to set the MySQL root password.

Next you need to build a database for PowerDNS to use. We will use the native mysql client to do this.

Now you can create and switch to the powerdns database.

Next you need to create the tables, columns, and indexes.

It is not a good idea to use the root password for your PowerDNS installation. So you need to create a database user and grant them privileges to do anything to the database you just created.

Installing PowerDNS

PowerDNS is available as a prebuilt RPM from the EPEL repo. You will need to install the repo before you can grab PowerDNS.

Now that the repo is installed you can install PowerDNS.

Configuring PowerDNS

Now that your database is setup, you will need to make a few changes to the configuration file for PowerDNS.

Uncomment the following line and set it to 127.0.0.1:5300. This tells PowerDNS to forward recursive queries to the PowerDNS-recursor server that will be listening on port 5300.

Add the following to the launch section:

Next you need to have the recursor listen on a different port as PowerDNS will already use udp port 53. You already configured PowerDNS to look for the recursor server on port 5300, so set the same in the recursors configuration file.

Set the port to 5300

In the allow from section lock it down to your loopback ip 127.0.0.1.

Next set the DNS and rDNS server to run on startup and start them manually for the first time.

If you are running IPTables, you will need to permit access through your firewall for http and DNS queries.

Installing PowerAdmin

First you need to install a few additional packages for PowerAdmin.

Now you are ready to download and install poweradmin into your html directory.

To continue configuring PowerAdmin you will need to open a web browser and goto http://youripadress/poweradmin/install

Step 1: Select your preferred language.

Step 1 of Poweradmin Install

Step 2: Confirm your Database is good to go!

Step 2 of Poweradmin Install

Step 3: Provide Database Details

Step 2 of Poweradmin Install

Step 4: Create PowerAdmin user and set Admin password.

Step 4 of Poweradmin Install

Step 5: Create less privileged user in DB for poweradmin.
PowerAdmin will display a bit of SQL you will need to enter into your command line mysql client. Make the SQL changes then click Go to Step 6.

Step 6: Create Config file for PowerDNS.
Power DNS will now present you with your php configuration file. Since your web server does not have permissions to create the file itself (this is a good thing) you need to manually create it.

Now paste the configuration into this file and save and exit. And click Goto Step 7 in the installer.

Step 7: Remove the installer from your web directory.
PowerAdmin will not let you do anything if you don’t remove the install directory first. So go ahead and remove it now that your done configuring it.

You should now be able to logon to PowerAdmin by browsing to http://ipadress/poweradmin/. You can login with admin password that was set during the installation process.

To test your new PowerDNS Server you can create a domain using the Poweradmin interface then use nslookup from a pc or server to query it. You can also do a few recursive lookups too to make sure that works.

Thats all there is to setting up PowerDNS and PowerAdmin. In another tutorial we will show you how to add redundancy to this setup using two VPS servers. Stay tuned!

-Tutor