pierce
15/07/08, 11:09
Omdat er regelmatig discussies zijn over het opzetten van secundaire DNS servers, hier een korte basic handleiding over hoe je een PowerDNS Superslaaf op zet.
Deze handleiding is met wat knip en plak werk in elkaar gezet(eigenlijk had je het dus ook zelf kunnen uitzoeken...), verwacht dus geen hoogstandjes :)
Verder wordt er uitgegaan van een kale CentOS 5.1 installatie voor PowerDNS en een werkende primaire nameserver met Bind(bijvb icm Directadmin).
Op- of aanmerkingen, toevoegingen, uitbreidingen, financiele bijdrage's(kunnen worden overgemaakt naar Postbank rekening 3481329 t.a.v. iData) etc. etc. zijn altijd welkom! :)
Configure Yum:
First we enable the RPMforge repository on our CentOS system as some of the packages that we are going to install in the course of this tutorial are not available in the official CentOS 5.1 repositories:
rpm -Uhv http://apt.sw.be/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm (http://apt.sw.be/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm)
Install Apache, MySQL etc.
This requires a webserver with PHP enabled and the MySQL database server. If you have already Apache, PHP and MySQL installed, you may skip this step. We also install phpMyAdmin here so that you have a web interface to the MySQL database in case you need it:
yum install httpd mysql-server php php-mysql php-mbstring phpmyadmin
Start MySQL:
chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start
Then set passwords for the MySQL root account:
mysqladmin -u root password yourrootsqlpassword
mysqladmin -h your.hostname.tld -u root password yourrootsqlpassword
Configure phpMyAdmin.
We change the Apache configuration so that phpMyAdmin allows connections not just from localhost (by commenting out the <Directory "/usr/share/phpmyadmin"> stanza):
Joe /etc/httpd/conf.d/phpmyadmin.conf
#
# Web application to manage MySQL
#
#<Directory "/usr/share/phpmyadmin">
# Order Deny,Allow
# Deny from all
# Allow from 127.0.0.1
#</Directory>
Alias /phpmyadmin /usr/share/phpmyadmin
Alias /phpMyAdmin /usr/share/phpmyadmin
Alias /mysqladmin /usr/share/phpmyadmin
Next we change the authentication in phpMyAdmin from cookie to http:
joe /usr/share/phpmyadmin/config.inc.php
[...]
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'http';
[...]
Then we create the system startup links for Apache and start it:
chkconfig --levels 235 httpd on
/etc/init.d/httpd start
Install PowerDNS:
Yum install pdns
Edit the PowerDNS Config file:
joe /etc/pdns/pdns.conf
# this option tells powerdns to use mysql
launch=gmysql
# the ip address of the mysql host
gmysql-host=127.0.0.1
# the mysql username
gmysql-user=root
# the mysql password
gmysql-password=changemeyesterday!
# the mysql database
gmysql-dbname=pdns
master=yes
# i have some customers that i'm slave for
# so i want to configure pdns to do master
# queries to the master dns servers of my
# customers
slave=yes
# Update every 60 seconds
slave-cycle-interval=60
# this option tells powerdns to start the statistics webserver
webserver=yes
# the ip address to which the webserver listenes
webserver-address=your.ip.here
# the port the webserver listenes
webserver-port=8081
# the webserver password
webserver-password=changemenow!
# tell what ip addresses can fetch zones from our master server
# as for example secondary dns servers
allow-axfr-ips=127.0.0.1
default-ttl=3600
Start PowerDNS on boot:
chkconfig --levels 235 pdns on
service pdns start
Create the PowerDNS database within phpmyadmin:
-- phpMyAdmin SQL Dump
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--
-- Database: `pdns`
--
-- --------------------------------------------------------
--
-- Tabel structuur voor tabel `domains`
--
CREATE TABLE IF NOT EXISTS `domains` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(255) NOT NULL,
`master` varchar(20) default NULL,
`last_check` int(11) default NULL,
`type` varchar(6) NOT NULL,
`notified_serial` int(11) default NULL,
`account` varchar(40) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name_index` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
--
-- Gegevens worden uitgevoerd voor tabel `domains`
--
INSERT INTO `domains` (`id`, `name`, `master`, `last_check`, `type`, `notified_serial`, `account`) VALUES
(1, 'test.nl', '123.123.123.123', 1204238157, 'SLAVE', NULL, 'internal');
-- --------------------------------------------------------
--
-- Tabel structuur voor tabel `records`
--
CREATE TABLE IF NOT EXISTS `records` (
`id` int(11) NOT NULL auto_increment,
`domain_id` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`type` varchar(6) NOT NULL,
`content` varchar(255) NOT NULL,
`ttl` int(11) NOT NULL,
`prio` int(11) default NULL,
`change_date` int(11) default NULL,
PRIMARY KEY (`id`),
KEY `name_index` (`name`),
KEY `nametype_index` (`name`,`type`),
KEY `domainid_index` (`domain_id`),
KEY `rec_name_index` (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
--
-- Gegevens worden uitgevoerd voor tabel `records`
--
INSERT INTO `records` (`id`, `domain_id`, `name`, `type`, `content`, `ttl`, `prio`, `change_date`) VALUES
(1, 1, 'test.nl', 'SOA', 'voorbeeld.idatahosting.nl. hostmaster.idatahosting.nl. 7 900 600 86400 3600', 3600, 0, NULL),
(2, 1, 'test.nl', 'NS', 'naamserver1.idatahosting.nl', 3600, 0, NULL),
(3, 1, 'test.nl', 'NS', 'naamserver2.idatahosting.nl', 3600, 0, NULL),
(4, 1, 'test.nl', 'MX', 'www', 3600, 10, NULL);
-- --------------------------------------------------------
--
-- Tabel structuur voor tabel `supermasters`
--
CREATE TABLE IF NOT EXISTS `supermasters` (
`ip` varchar(25) NOT NULL,
`nameserver` varchar(255) NOT NULL,
`account` varchar(40) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Gegevens worden uitgevoerd voor tabel `supermasters`
--
INSERT INTO `supermasters` (`ip`, `nameserver`, `account`) VALUES
('123.123.123.123', 'master.domeinnaam.tld', 'internal');
On the primary nameserver:
Edit named:
Joe /etc/named.conf
And add the lines:
allow-transfer { 192.168.0.0/24; 123.123.123.123; IP van de PowerDNS Slaaf;
notify yes;
also-notify {IP van de PowerDNS Slaaf;};
Note:
Windows 2003 has a problem when replicating with PowerDNS, and thus records like A and CNAME are not replicated, only SOA, NS and MX records!
There's a workaround for this problem, somewhere....
P.S. Garantie tot aan de deur :D
Deze handleiding is met wat knip en plak werk in elkaar gezet(eigenlijk had je het dus ook zelf kunnen uitzoeken...), verwacht dus geen hoogstandjes :)
Verder wordt er uitgegaan van een kale CentOS 5.1 installatie voor PowerDNS en een werkende primaire nameserver met Bind(bijvb icm Directadmin).
Op- of aanmerkingen, toevoegingen, uitbreidingen, financiele bijdrage's(kunnen worden overgemaakt naar Postbank rekening 3481329 t.a.v. iData) etc. etc. zijn altijd welkom! :)
Configure Yum:
First we enable the RPMforge repository on our CentOS system as some of the packages that we are going to install in the course of this tutorial are not available in the official CentOS 5.1 repositories:
rpm -Uhv http://apt.sw.be/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm (http://apt.sw.be/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm)
Install Apache, MySQL etc.
This requires a webserver with PHP enabled and the MySQL database server. If you have already Apache, PHP and MySQL installed, you may skip this step. We also install phpMyAdmin here so that you have a web interface to the MySQL database in case you need it:
yum install httpd mysql-server php php-mysql php-mbstring phpmyadmin
Start MySQL:
chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start
Then set passwords for the MySQL root account:
mysqladmin -u root password yourrootsqlpassword
mysqladmin -h your.hostname.tld -u root password yourrootsqlpassword
Configure phpMyAdmin.
We change the Apache configuration so that phpMyAdmin allows connections not just from localhost (by commenting out the <Directory "/usr/share/phpmyadmin"> stanza):
Joe /etc/httpd/conf.d/phpmyadmin.conf
#
# Web application to manage MySQL
#
#<Directory "/usr/share/phpmyadmin">
# Order Deny,Allow
# Deny from all
# Allow from 127.0.0.1
#</Directory>
Alias /phpmyadmin /usr/share/phpmyadmin
Alias /phpMyAdmin /usr/share/phpmyadmin
Alias /mysqladmin /usr/share/phpmyadmin
Next we change the authentication in phpMyAdmin from cookie to http:
joe /usr/share/phpmyadmin/config.inc.php
[...]
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'http';
[...]
Then we create the system startup links for Apache and start it:
chkconfig --levels 235 httpd on
/etc/init.d/httpd start
Install PowerDNS:
Yum install pdns
Edit the PowerDNS Config file:
joe /etc/pdns/pdns.conf
# this option tells powerdns to use mysql
launch=gmysql
# the ip address of the mysql host
gmysql-host=127.0.0.1
# the mysql username
gmysql-user=root
# the mysql password
gmysql-password=changemeyesterday!
# the mysql database
gmysql-dbname=pdns
master=yes
# i have some customers that i'm slave for
# so i want to configure pdns to do master
# queries to the master dns servers of my
# customers
slave=yes
# Update every 60 seconds
slave-cycle-interval=60
# this option tells powerdns to start the statistics webserver
webserver=yes
# the ip address to which the webserver listenes
webserver-address=your.ip.here
# the port the webserver listenes
webserver-port=8081
# the webserver password
webserver-password=changemenow!
# tell what ip addresses can fetch zones from our master server
# as for example secondary dns servers
allow-axfr-ips=127.0.0.1
default-ttl=3600
Start PowerDNS on boot:
chkconfig --levels 235 pdns on
service pdns start
Create the PowerDNS database within phpmyadmin:
-- phpMyAdmin SQL Dump
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--
-- Database: `pdns`
--
-- --------------------------------------------------------
--
-- Tabel structuur voor tabel `domains`
--
CREATE TABLE IF NOT EXISTS `domains` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(255) NOT NULL,
`master` varchar(20) default NULL,
`last_check` int(11) default NULL,
`type` varchar(6) NOT NULL,
`notified_serial` int(11) default NULL,
`account` varchar(40) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name_index` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
--
-- Gegevens worden uitgevoerd voor tabel `domains`
--
INSERT INTO `domains` (`id`, `name`, `master`, `last_check`, `type`, `notified_serial`, `account`) VALUES
(1, 'test.nl', '123.123.123.123', 1204238157, 'SLAVE', NULL, 'internal');
-- --------------------------------------------------------
--
-- Tabel structuur voor tabel `records`
--
CREATE TABLE IF NOT EXISTS `records` (
`id` int(11) NOT NULL auto_increment,
`domain_id` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`type` varchar(6) NOT NULL,
`content` varchar(255) NOT NULL,
`ttl` int(11) NOT NULL,
`prio` int(11) default NULL,
`change_date` int(11) default NULL,
PRIMARY KEY (`id`),
KEY `name_index` (`name`),
KEY `nametype_index` (`name`,`type`),
KEY `domainid_index` (`domain_id`),
KEY `rec_name_index` (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
--
-- Gegevens worden uitgevoerd voor tabel `records`
--
INSERT INTO `records` (`id`, `domain_id`, `name`, `type`, `content`, `ttl`, `prio`, `change_date`) VALUES
(1, 1, 'test.nl', 'SOA', 'voorbeeld.idatahosting.nl. hostmaster.idatahosting.nl. 7 900 600 86400 3600', 3600, 0, NULL),
(2, 1, 'test.nl', 'NS', 'naamserver1.idatahosting.nl', 3600, 0, NULL),
(3, 1, 'test.nl', 'NS', 'naamserver2.idatahosting.nl', 3600, 0, NULL),
(4, 1, 'test.nl', 'MX', 'www', 3600, 10, NULL);
-- --------------------------------------------------------
--
-- Tabel structuur voor tabel `supermasters`
--
CREATE TABLE IF NOT EXISTS `supermasters` (
`ip` varchar(25) NOT NULL,
`nameserver` varchar(255) NOT NULL,
`account` varchar(40) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Gegevens worden uitgevoerd voor tabel `supermasters`
--
INSERT INTO `supermasters` (`ip`, `nameserver`, `account`) VALUES
('123.123.123.123', 'master.domeinnaam.tld', 'internal');
On the primary nameserver:
Edit named:
Joe /etc/named.conf
And add the lines:
allow-transfer { 192.168.0.0/24; 123.123.123.123; IP van de PowerDNS Slaaf;
notify yes;
also-notify {IP van de PowerDNS Slaaf;};
Note:
Windows 2003 has a problem when replicating with PowerDNS, and thus records like A and CNAME are not replicated, only SOA, NS and MX records!
There's a workaround for this problem, somewhere....
P.S. Garantie tot aan de deur :D