Difference between revisions of "Network/DNS"
Jump to navigation
Jump to search
(→Geo) |
|||
Line 93: | Line 93: | ||
=== Geo === | === Geo === | ||
− | In pdns.d/pdns.local, add: | + | In '''pdns.d/pdns.local''', add: |
<pre> | <pre> | ||
Line 102: | Line 102: | ||
</pre> | </pre> | ||
− | geo-maps/lunasys | + | Write '''geo-maps/lunasys''': |
<pre> | <pre> | ||
Line 119: | Line 119: | ||
rsync -avz rsync://countries-ns.mdc.dk/zone . | rsync -avz rsync://countries-ns.mdc.dk/zone . | ||
− | And copy the zz.countries.nerd.dk.rbldnsd in '''/etc/powerdns/''' | + | And copy the '''zz.countries.nerd.dk.rbldnsd''' in '''/etc/powerdns/''' |
Revision as of 00:35, 24 June 2012
PowerDNS
General Configuration
/etc/powerdns/pdns.conf
allow-recursion=127.0.0.1 config-dir=/etc/powerdns daemon=yes disable-axfr=yes guardian=yes lazy-recursion=yes local-address=0.0.0.0 local-port=53 loglevel=8 module-dir=/usr/lib/powerdns setgid=pdns setuid=pdns socket-dir=/var/run webserver=yes webserver-address=0.0.0.0 webserver-password=<pass> webserver-port=8080 version-string=powerdns launch=gmysql,geo include=/etc/powerdns/pdns.d
MySQL
MySQL tables (and samples):
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(128) 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=2 DEFAULT CHARSET=latin1; INSERT INTO `domains` VALUES (1,'lunasys.fr',NULL,NULL,'NATIVE',NULL,NULL); 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(64000) DEFAULT NULL, `ttl` int(11) DEFAULT NULL, `prio` int(11) DEFAULT NULL, `change_date` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `rec_name_index` (`name`), KEY `nametype_index` (`name`,`type`), KEY `domain_id` (`domain_id`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1; INSERT INTO `records` VALUES (3,1,'as.www.lunasys.fr','A','3.1.1.1',600,NULL,NULL),(4,1,'us.www.lunasys.fr','A','2.1.1.1',600,NULL,NULL),(5,1,'eu.www.lunasys.fr','A','4.1.1.1',600,NULL,NULL); 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;
In pdns.d/pdns.local, add:
gmysql-host=127.0.0.1 gmysql-user=root gmysql-password=<pass> gmysql-dbname=pdns
Geo
In pdns.d/pdns.local, add:
geo-zone=lunasys.fr #geo-ns-records=ns0.lunasys.fr geo-ip-map-zonefile=/etc/powerdns/zz.countries.nerd.dk.rbldnsd geo-maps=/etc/powerdns/geo-maps
Write geo-maps/lunasys:
$RECORD www $ORIGIN lunasys.fr. 56 eu.www 344 as.www 250 eu.www 840 us.www 124 us.www 0 eu.www
Finally retrieve countries zone file with the following rsync command:
rsync -avz rsync://countries-ns.mdc.dk/zone .
And copy the zz.countries.nerd.dk.rbldnsd in /etc/powerdns/