introducing powerdns

12
POWER DNS SEPT 2013 Anu Bhaskar www.anubhaskar.name Creative Commons Attribution-ShareAlike 3.0 Unported License.

Upload: anu-bhaskar

Post on 18-May-2015

1.439 views

Category:

Technology


2 download

DESCRIPTION

These are the slides I used in my local libre user group meetup to introduce PowerDNS to my friends and users from varied backgrounds.

TRANSCRIPT

Page 1: Introducing Powerdns

POWER DNSSEPT 2013

Anu Bhaskar www.anubhaskar.name

Creative Commons Attribution-ShareAlike 3.0 Unported License.

Page 2: Introducing Powerdns

2

1.Introduction2.Domain Name System3.Database Configuration4.PowerDNS Configuration5.PowerAdmin Configuration6.DNS Record creation

AGENDA

Creative Commons Attribution-ShareAlike 3.0 Unported License.

Page 3: Introducing Powerdns

3

1. Hierarchical distributed naming system for resources connected to network

2.Mainly used to translate domain names to IP addresses

3. Consists of DNS protocol, data structure specifications and data communication exchanges

Domain Name System

Creative Commons Attribution-ShareAlike 3.0 Unported License.

Page 4: Introducing Powerdns

4

Domain Name System

Creative Commons Attribution-ShareAlike 3.0 Unported License.

Client(10.10.10.2)

DNS(10.10.10.3)

Web server(www.example.com)

(10.10.10.4)

(1)What

is the

ip add

ress of

www.e

xample

.com

(2) IP

address

of ww

w.exam

ple.co

m is 10.

10.10.

4

(3) Connection Established

Page 5: Introducing Powerdns

5

Database Configuration

Creative Commons Attribution-ShareAlike 3.0 Unported License.

Install MariaDB# yum install MariaDB-server# yum install MariaDB-client

Configure MariaDB# vi /etc/my.cnf.d/server.cnf[server]bind-address=127.0.0.1

# service mysql start# /usr/bin/mysql_secure_installation

Create an sql script to create mariadb database for storing DNS records# vi /root/pdns.sqlCREATE DATABASE pdb;

GRANT ALL ON pdb.* TO 'padmin'@'localhost' IDENTIFIED BY 'p1234';GRANT ALL ON pdb.* TO 'padmin'@'localhost.localdomain' IDENTIFIED BY 'p1234';FLUSH PRIVILEGES;

USE pdb;

Page 6: Introducing Powerdns

6

Database Configuration

Creative Commons Attribution-ShareAlike 3.0 Unported License.

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(10) DEFAULT NULL,content VARCHAR(64000) DEFAULT NULL,ttl INT DEFAULT NULL,prio INT DEFAULT NULL,change_date INT DEFAULT NULL,primary key(id));

Page 7: Introducing Powerdns

7

Database Configuration

Creative Commons Attribution-ShareAlike 3.0 Unported License.

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

CREATE TABLE supermasters (ip VARCHAR(64) NOT NULL,nameserver VARCHAR(255) NOT NULL,account VARCHAR(40) DEFAULT NULL);

Create database from sql script# mysql -u root -p < /root/pdns.sql

Page 8: Introducing Powerdns

8

PowerDNS Configuration

Creative Commons Attribution-ShareAlike 3.0 Unported License.

Install PowerDNS# yum install pdns pdns-backend-mysql

Configure mysql backend credentials in PowerDNS# vi /etc/pdns/pdns.conflaunch=gmysqlgmysql-host=127.0.0.1gmysql-user=padmingmysql-password=p1234gmysql-dbname=pdb

Start PowerDNS# service pdns start

Page 9: Introducing Powerdns

9

PowerAdmin Configuration

Creative Commons Attribution-ShareAlike 3.0 Unported License.

Install Apache webserver# yum install httpd

Install php# yum install php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt gettext php-pear-DB php-pear-MDB2-Driver-mysql

Configure Apache webserver# vi /etc/httpd/conf/httpd.confServerName 10.10.10.3:80

Start Apache webserver# service httpd start

Check php configurations by looking at http://10.10.10.3/info.php after saving below file# vi /var/www/html/info.php<?phpphpinfo();?>

Page 10: Introducing Powerdns

10

PowerAdmin Configuration

Creative Commons Attribution-ShareAlike 3.0 Unported License.

Download PowerAdmin# wget https://github.com/downloads/poweradmin/poweradmin/poweradmin-2.1.6.tgz # tar -xvzf poweradmin-2.1.6.tgz# cp -pr poweradmin-2.1.6 /var/www/html/poweradmin# chown -R root:root /var/www/html/poweradmin

Login to PowerAdmin web installhttp://10.10.10.3/poweradmin/install

Select option “I prefer to proceed in English” in installation step 1

Proceed to next page in installation step 2

Enter below details in installation step 3Username=padminPassword=p1234Database type=MySQLHostname=127.0.0.1DB Port=3306Database=pdbPoweradmin administrator password=admin1234

Page 11: Introducing Powerdns

11

PowerAdmin Configuration

Creative Commons Attribution-ShareAlike 3.0 Unported License.

Enter below details in installation step 4Username=adminPassword=admin1234Hostmaster=hostmaster.test.labPrimary nameserver=ns1.test.labSecondary nameserver=ns2.test.lab

Run the sql query displayed in installation step 5 inside MariaDB#mysql -u root -p

Save the contents printed on the page to /var/www/html/poweradmin/inc/config.inc.php in installation step 6

Remove install directory and login to poweradmin website using the specified link and credentials in installation step 7# rm -rf /var/www/html/poweradmin/install

Page 12: Introducing Powerdns

12

DNS record creation

Creative Commons Attribution-ShareAlike 3.0 Unported License.

Create a master zone example.com and below records in itwww.example.com A 192.168.10.10internal.example.com A 192.168.10.20mail.example.com MX internal.example.comchat.example.com CNAME www.example.com 192.168.10.20 PTR internal.example.com

Install DNS client dig# yum install bind-utils

Query PowerDNS server using dig to return above records# dig @10.10.10.3 www.example.com A# dig @10.10.10.3 internal.example.com A# dig @10.10.10.3 mail.example.com MX# dig @10.10.10.3 chat.example.com# dig @10.10.10.3 192.168.10.20.example.com PTR

Log in to MariaDB and show stored DNS records in database# mysql -u root -pmysql> use pdb;mysql> select * from domains;mysql> select * from records;mysql> exit;