Powerdns installation with Mysql backend and Poweradmin webcontrol panel – Dns Server

By | August 26, 2009

Purpose Of Dns

The Domain Name System (DNS) is a hierarchical naming system for computers, services, or any resource connected to the Internet or a private network. It associates various information with domain names assigned to each of the participants. Most importantly, it translates domain names meaningful to humans into the numerical (binary) identifiers associated with networking equipment for the purpose of locating and addressing these devices worldwide. An often used analogy to explain the Domain Name System is that it serves as the “phone book” for the Internet by translating human-friendly computer hostnames into IP addresses. For example, www.talk2melbin.com translates to 69.65.3.173. The name resolution (Dns service) is provided with the help of Dns Servers.

Here we are explaining to setup PowerDns with Mysql backend, this is one popular Dns Server used right now. The web interface tool will help us to easily configure the Dns entires eg: A entry, MX entry ..

Installation And Configuration Of PowerDns

Check the installed packages,

# rpm -qa | grep mysql

# rpm -qa | grep http

# rpm -qa | grep php

Command will grep the total installed packages and find out whether mysql server, apache and php packages are installed on the Linux box.

*If the packages are installed skip the installation procedure and configure accordingly.

Configure Mysql Server

1. Install Mysql Server and it’s components. Here we are using ‘yum’ command for installation.

# yum install mysql mysql-devel mysql-server

2. Edit the my.cnf file.

# vi /etc/my.cnf

Comment the line if present,

#bind-address = 127.0.0.1

3. Start Mysql Server service

# /etc/init.d/mysqld start

4. Check the service

# netstat -tap | grep mysql

5. Secure mysql server with root password

#mysqladmin -u root password ‘secretpass’

6. Create Database and Tables for powerdns

a) Create Database,

Login into mysql

# mysql -u root -p

# CREATE DATABASE powerdns;

# GRANT ALL ON powerdns.* TO ‘pdnsadmin’@’%’ IDENTIFIED BY ‘pdnspassword';

# FLUSH PRIVILEGES;

b) Create Tables,

# USE powerdns;

# CREATE TABLE domains (

id INT auto_increment,

name VARCHAR(255) NOT NULL,

master VARCHAR(128) DEFAULT NULL,

last_check INT DEFAULT NULL,

type VARCHAR(6) NOT NULL,

notified_serial INT DEFAULT NULL,

account VARCHAR(40) DEFAULT NULL,

primary key (id)

);

# CREATE UNIQUE INDEX name_index ON domains(name);

# CREATE TABLE records (

id INT auto_increment,

domain_id INT DEFAULT NULL,

name VARCHAR(255) DEFAULT NULL,

type VARCHAR(6) DEFAULT NULL,

content VARCHAR(255) DEFAULT NULL,

ttl INT DEFAULT NULL,

prio INT DEFAULT NULL,

change_date INT DEFAULT NULL,

primary key(id)

);

# CREATE INDEX rec_name_index ON records(name);

# CREATE INDEX nametype_index ON records(name,type);

# CREATE INDEX domain_id ON records(domain_id);

# CREATE TABLE supermasters (

ip VARCHAR(25) NOT NULL,

nameserver VARCHAR(255) NOT NULL,

account VARCHAR(40) DEFAULT NULL

);

# quit;

Install and Configure PowerDns package

1. Install PowerDns package using ‘yum’

# yum install -y pdns pdns-backend-mysql

2. Configure powerdns with mysql

# vi /etc/pdns/pdns.conf

Edit/Add the file with,

launch=gmysql

gmysql-host=127.0.0.1

gmysql-user=pdnsadmin

gmysql-password=pdnspassword

gmysql-dbname=powerdns

3. Set powerdns recursion

powerdns recursion

Add the name servers line by line,

recursion=primarynameserverip

recursion=secondarynameserverip

4. Start pdns service

# /etc/init.d/pdns restart

Install, Configure Apache and php

1. Install the packages using ‘yum’

# yum install httpd php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-mhash gettext

# yum -y install php-pear-DB php-pear-MDB2-Driver-mysql

PowerAdmin Web Interface Setup

1. Go to poweradmin website and download the latest version,

https://www.poweradmin.org/trac/wiki/GettingPoweradmin

# cd /tmp

# wget https://www.poweradmin.org/download/poweradmin-2.1.3.tgz (Get the latest version)

2. Extract the poweradmin tgz

# tar xvfz poweradmin-2.1.3.tgz

3. Move it to Apache document root (you can also create a separate vhost entry under apache to increase the security)

# mv poweradmin-2.1.3 /var/www/html/pdns

# touch /var/www/html/pdns/inc/config.inc.php

# chown -R apache:apache /var/www/html/pdns

4. Open the pdns on browser and access the installation directory,

Ex: http://192.168.0.9/pdns/install

PowerAdmin Installation Steps

Step 1. Select, I prefer to proceed in english

Step 2. Click, Go to step 3

Step 3.

a) Username – root (Fill the entry with root user of the mysql, dont use pdnsadmin user)

b) Password – secretpass (mysql server root password)

c) Hostname – localhost

d) Database – powerdns

e) Database Type – Mysql

f) Poweradmin password – pass (This is password for admin user, used to login poweradmin control panel)

Step 4.

a) Username – pdnsadmin

b) Password – pdnspassword

c) Hostmaster – admin@talk2melbin.com

d) Primary NS – ns1.talk2melbin.com

e) SecondaryNs- ns2.talk2melbin.com

Step 5. Click, Go to step 6

Step 6. Click, Go to step 7 (writing the values into /inc/config.inc.php)

Step 7. Configuration Finished (Note the login details)

Remove the install directory,

# rm -rf /var/www/html/pdns/install

Login into PowerDns and set up zone

1. Login into poweradmin

http;//192.168.0.9/pdns/

UserName – admin

Password – pass

2. Add Master zone by entering the doamin name ‘talk2melbin.com’ and ip address.

*Uncheck create zone without applying records-template.Poweradmin will automatically create some NS, A (e.g. www) and MX records for the zone

*Add dns entries according to the need.

3. Test Name server using ‘dig’ and ‘hostname’ commands

* If firewall is applied, open the 53 Dns port.

* In case of error check ‘tail -f /var/log/messages’.

Melbin Mathew

I am Melbin Mathew, Systems Engineer from Kerala, India. I live with my parents, daughter and my wonderful wife. I graduated in 2004 with a bachelor’s degree in Electronics and Hardware from Mahatma Gandhi University, Kottayam and completed certification in MCITP, RHCE, CCNA, VCP ...Read More
Category: Linux

About Melbin Mathew

I am Melbin Mathew, Systems Engineer from Kerala, India. I live with my parents, daughter and my wonderful wife. I graduated in 2004 with a bachelor’s degree in Electronics and Hardware from Mahatma Gandhi University, Kottayam and completed certification in MCITP, RHCE, CCNA, VCP ...Read More

  • http://nailfunguspictures.shtoho.net/ Lashaun Zeise

    I admire ur job!

    • http://www.talk2melbin.com Melbin Mathew

      Thank you for the feedback.