DNS server PowerDNS

DNS server PowerDNS

Vytoření databáze:

CREATE DATABASE powerdns;
GRANT ALL ON powerdns.* TO 'powerdns'@'localhost' IDENTIFIED BY 'powerdns_user_password';
FLUSH PRIVILEGES;
USE powerdns;

DROP TABLE IF EXISTS `cryptokeys`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cryptokeys` (
 `id` int(11) NOT NULL AUTO_INCREMENT,
 `domain_id` int(11) NOT NULL,
 `flags` int(11) NOT NULL,
 `active` tinyint(1) DEFAULT NULL,
 `content` text,
 PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `domainmetadata`
--

DROP TABLE IF EXISTS `domainmetadata`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `domainmetadata` (
 `id` int(11) NOT NULL AUTO_INCREMENT,
 `domain_id` int(11) NOT NULL,
 `kind` varchar(16) DEFAULT NULL,
 `content` text,
 PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `domains`
--

DROP TABLE IF EXISTS `domains`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `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 AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `records`
--

DROP TABLE IF EXISTS `records`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `records` (
 `id` int(11) NOT NULL AUTO_INCREMENT,
 `domain_id` int(11) DEFAULT NULL,
 `name` varchar(255) DEFAULT NULL,
 `type` varchar(10) DEFAULT NULL,
 `content` varchar(255) DEFAULT NULL,
 `ttl` int(11) DEFAULT NULL,
 `prio` int(11) DEFAULT NULL,
 `change_date` int(11) DEFAULT NULL,
 disabled TINYINT(1) DEFAULT 0,
 `ordername` varchar(255) DEFAULT NULL,
 `auth` tinyint(1) DEFAULT NULL,
 PRIMARY KEY (`id`),
 KEY `rec_name_index` (`name`),
 KEY `nametype_index` (`name`,`type`),
 KEY `domain_id` (`domain_id`),
 KEY `orderindex` (`ordername`),
 CONSTRAINT `records_ibfk_1` FOREIGN KEY (`domain_id`) REFERENCES `domains` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `supermasters`
--

DROP TABLE IF EXISTS `supermasters`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `supermasters` (
 `ip` varchar(25) NOT NULL,
 `nameserver` varchar(255) NOT NULL,
 `account` varchar(40) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `tsigkeys`
--

DROP TABLE IF EXISTS `tsigkeys`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tsigkeys` (
 `id` int(11) NOT NULL AUTO_INCREMENT,
 `name` varchar(255) DEFAULT NULL,
 `algorithm` varchar(255) DEFAULT NULL,
 `secret` varchar(255) DEFAULT NULL,
 PRIMARY KEY (`id`),
 UNIQUE KEY `namealgoindex` (`name`,`algorithm`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

 

Instalace

 

apt-get install -y pdns-server pdns-backend-mysql

 

rm /etc/powerdns/pdns.d/* vi /etc/powerdns/pdns.d/pdns.local.gmysql.conf

Do souboru vi /etc/powerdns/pdns.d/pdns.local.gmysql.conf zadat MySQL údaje.

# MySQL Configuration file
launch=gmysql
gmysql-host=localhost
gmysql-dbname=powerdns
gmysql-user=powerdns_user
gmysql-password=powerdns_user_password

Restartovat 

service pdns restart


netstat -tap | grep pdns
dig @127.0.0.1 Stáhnout http://www.poweradmin.org/, rozbalit do /var/www/poweradmin, přidat do apache vi /etc/apache2/sites-enabled/poweradmin.conf: Alias /poweradmin /var/www/poweradmin <Directory /var/www/poweradmin> Options FollowSymLinks DirectoryIndex index.php </Directory> Nastavení pro slave DNS (transfer zóny): allow-axfr-ips=192.168.101.100/32

Více instancí PowerDNS na jednom serveru

Hodí se to, když chcete vracet rozdílné odpovědi různým klientům. – viz jiný příspěvek