Nuestros Centros de Datos
Sep 18

This tutorial will explain how to synchronize many DNS servers (with bind) with one (primary) or two (primary and secondary) DNS servers. It may help DNS administration process and may simplify the process to migrate webhosting accounts between diferent servers, or if you want to change the IP addresses that handle the domains. (For example if you need to migrate yours servers from one DataCenter to another, because you don’t need to change the DNS Servers for each domain). It may decrease the propagation time that takes Domain Name Servers changes (24-48 hours).

This tutorial may be helfull if you have a DNS server for each webhosting server with bind running. I have tested and implemented this tutorial in our WebHosting Company, we have several servers with cPanel, DirectAdmin and Plesk under Windows and it’s working fine!

Our primary and secundary DNS servers will run PowerDNS with MySQL frontend (all DNS data will stored into a MySQL Data Base). All webhosting servers will send the data to the Primary DNS server using the also-notify BIND option. And the primary server will sync the data to the secondary server using MySQL replication. If you need a tool for manage all DNS records I recomend PowerAdmin a web interface for PowerDNS.

We are using CentOs 5.2 for each DNS server, you may use the distro that you want. With CentOs install the utilities was very easy, we did the install with yum

yum install pdns.i386 pdns-backend-mysql.i386 mysql-server

You may change the architecture, and if you want you can install PHP, Apache and PHP-MySQL if you want to run the PowerAdmin.

I also configured the initial scripts for PorweDNS and MySQL

chkconfig –levels 456 pdns on
chkconfig –levels 456 mysqld on

Started mysql

service mysqld start

Now you need to configure your Database and MySQL User. For that you need to create a Database, create user and give privileges to the Database and create the structure of the tables that PowerDNS needs.

#mysql
mysql> create database pdns;
mysql> grant all privileges on pdns.* to ‘pdns’@'localhost’ IDENTIFIED BY ‘xxxxxx’;

Now you need to create the database structure with this scheme

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)
)type=InnoDB;

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)
)type=InnoDB;

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
);

Now we need to configure our PowerDNS to use MySQL Frontend, you need to modify /etc/pdns/pdns.conf and add to the end of the file the following lines, remember to change the pdns password

launch=gmysql
gmysql-host=127.0.0.1
gmysql-user=pdns
gmysql-password=xxxxxx
gmysql-dbname=pdns

Start PowerDNS in monitor mode and see if it connect suscefull to the Database.

service pdns monitor

written by admin


Comments are closed.

i3Theme sponsored by Top 10 Web Hosting and Hosting in Colombia