Bind+dlz+mysql Dynamic Update for zone records

Source: Internet
Author: User
Tags openssl openssl version

BIND-DLZ Experiment: http://bind-dlz.sourceforge.net/ Experimental environment: rhel4,bind-9.5.0-p2.tar.gz (9.4.0 above has dlz patch), MYSQL-5.0.56.TAR.GZ1, install Mysql (first install GCC and other related software packages) #tar ZXVF Mysql-5.0.56.tar.gz
#cd mysql-5.0.56
#./configure--prefix=/usr/local/mysql--localstatedir=/usr/loal/mysql/data--libexecdir=/usr/local/mysql/lib-- Disable-shared
#make
#make Install
#cd/usr/local/mysql/
#groupadd-G 1003 MySQL
#useradd-G 1003 MySQL
#chown-R MySQL.
#chgrp-R MySQL.
#chown-R MySQL Lib
#./bin/mysql_install_db--user=mysql//install as a user of MySQL
#chown-R Root.
#./bin/mysqld_safe--user=mysql &//Start MySQL in the background

# cd/root/mysql-5.0.56
# CP SUPPORT-FILES/MY-MEDIUM.CNF/ETC/MY.CNF
# CP Support-files/mysql.server/etc/rc.d/init.d/mysqld
# chmod 700!$
# chkconfig--add mysqld
# chkconfig--list mysqld
Mysqld 1:off 2:on 3:on 4:on 5:on 6:off
# service Mysqld Start[restart/reload/stop]
# VI/ETC/MY.CNF
Add this: ( PreventMySQLafter the server has no query8hourly Automatic re-connect)
Wait_timeout = 86400

interactive_timeout = 86400

#/usr/local/mysql/bin/mysqladmin-uroot password ' Aptech '
#./bin/mysql-uroot-paptech #echo "path= $PATH:/usr/local/mysql/bin" >>/etc/profile #. !$ 2, install bind #tar ZXVF bind-9.5.0-p2.tar.gz
#cd BIND-9.5.0-P2
#./configure--prefix=/usr/local/bind9--with-dlz-mysql=/usr/local/mysql--enable-threads=no//--with-dlz-mysql=/ Usr/local/mysql require bind installation to support DLZ//--enable-threads=no turn off multithreading//--disable-openssl-version-check disable OpenSSL version checking
#make
#make Install

3. Creating database,table   Create DATABASE mydata;   use mydata;   CREATE TABLE Other_dns_ Records (   zone varchar (255),   host varchar (255),   type varchar (255),   Data varchar (255),   TTL int (one),   mx_priority varchar (255),    Refresh int (11), & nbsp;  Retry int (one),   expire int (one),   minimum int (one),   serial bigint (11),    Resp_person varchar (255),    Primary_ns varchar (255));    CREATE TABLE CNC _dns_records (   host varchar (255),   type varchar (255),   data varchar (255),    TTL int (one),   mx_priority varchar (255),    Refresh int (one),   retry int (11) ,   expire int (one),   minimum int (one),   serial bigint (one),   Resp_person varchar (255),    Primary_ns varchar (255));      Insert Other_dns_records (zone,host,type,data,ttl,retry)    values (' aaa.com ', ' www ', ' A ', ' 192.168.199.2 ', ' 86400 ', ' + ');   insert Cnc_dns_records (zone,host,type,data,ttl,retry)    values (' bbb.com ', ' www ', ' A ', ' 192.55.199.199 ', ' 86400 ', ' 13 '), 4, edit/usr/local/bind9/etc/named.conf   #cd/usr/local/bind9/etc    #.. /sbin/rndc-confgen-a   #. /sbin/rndc-confgen > named.conf   #vi!$   //vi named.conf   #less named.conf # Use with the following in named.conf, adjusting the Allow list as needed:
Key "Rndc-key" {
Algorithm HMAC-MD5;
Secret "c4auv+n7gbof773v+/lnaa==";
};

Controls {
inet 127.0.0.1 Port 953
Allow {127.0.0.1;} keys {"Rndc-key";};
};
# End of named.conf
Options {
Directory "/usr/local/bind9/etc/";
Pid-file "/usr/local/bind9/var/run/named.pid";
allow-query {any;};
Recursion No;
Version "Gaint-d1";
};
Include "/usr/local/bind9/etc/cnc.cl";
Include "/usr/local/bind9/etc/other.cl";
View "Cnc-user" {
match-clients {cnc;};
Dlz "Mysql zone" {
Database "MySQL
{host=localhost dbname=mydata ssl=false port=3306 user=root Pass=aptech}
{Select zone from cnc_dns_records where zone = '%zone% '}
{Select TTL, type, mx_priority, case if lower (type) = ' txt ' then concat (' \ "', data,
‘\"‘)
When lower (type) = ' SOA ' then Concat_ws ('
', data, Resp_person, serial, refresh, retry, expire, minimum) else data end as MyData from
Cnc_dns_records where zone = '%zone% ' and host = '%record% '} ";
};
};
View "Other-user" {
match-clients {other;};
Dlz "Mysql zone" {
Database "MySQL
{host=localhost dbname=mydata ssl=false port=3306 user=root Pass=aptech}
{Select zone from other_dns_records where zone= '%zone% '}
{Select TTL, type, mx_priority, case if lower (type) = ' txt ' then concat (' \ "', data,
‘\"‘)
When lower (type) = ' SOA ' then Concat_ws ('
', data, Resp_person, serial, refresh, retry, expire, minimum) else data end as MyData from
Other_dns_records where zone = '%zone% ' and host = '%record% '} ";
};
};
[email protected] etc]# less cnc.cl
ACL "CNC" {
192.168.9.0/24;
};
[email protected] etc]# less other.cl
ACL "other" {
127.0.0.0/18;
}; 5. Start & test [[email protected] ~]#/usr/local/bind9/sbin/named-gc/usr/local/bind9/etc/named.conf
06-mar-2009 22:23:02.569 starting BIND 9.5.0-p2-gc/usr/local/bind9/etc/named.conf
06-mar-2009 22:23:02.579 loading configuration from '/usr/local/bind9/etc/named.conf '
06-mar-2009 22:23:02.583 listening on IPv4 interface lo, 127.0.0.1#53
06-mar-2009 22:23:02.586 listening on IPv4 interface eth0, 192.168.1.5#53
06-mar-2009 22:23:02.588 Loading ' mysql zone ' using driver MySQL
06-mar-2009 22:23:02.604 default max-cache-size (33554432) Applies:view Cnc-user
06-mar-2009 22:23:02.609 Loading ' mysql zone ' using driver MySQL
06-mar-2009 22:23:02.612 default max-cache-size (33554432) Applies:view Other-user
06-mar-2009 22:23:02.616 default max-cache-size (33554432) Applies:view _bind
06-mar-2009 22:23:02.621 command channel listening on 127.0.0.1#953
06-mar-2009 22:23:02.621 ignoring config file logging statement due to-g option
06-mar-2009 22:23:02.623 Running
Note: The-GC parameter can be used to display the boot log for error troubleshooting; The display running indicates that the configuration is correct.
Source: http://blog.chinaunix.net/uid-10435474-id-2957057.html

From for notes (Wiz)

Bind+dlz+mysql Dynamic Update for zone records

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.