bind dlz 安装配置

Standard

cd /usr/local/src
wget ftp://ftp.bind.com/pub/bind9/9.5.0/bind-9.5.0.tar.gz
tar zxvf bind-9.5.0.tar.gz
cd bind-9.5.0
./configure –with-dlz-mysql –enable-threads –prefix=/usr/local/bind
make
make install
cd /usr/local/bind/etc/
../sbin/rndc-confgen >rndc.conf
tail -n10 rndc.conf | head -n9 | sed -e s/#\//g >named.conf
vi localhost.zone

ttl 86400
@ IN SOA localhost. root.localhost. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS localhost.
1 IN PTR localhost.

dig > named.root
vi named.conf

在最后加上
dlz “Mysql zone” {
database “mysql
{host=127.0.0.1 dbname=dns ssl=false port=3306 user=root pass= }
{select zone from dns_records where zone = ‘%zone%’ limit 1}
{select ttl, type, mx_priority, case when 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 dns_records where zone = ‘%zone%’ and host = ‘%record%’}
{}
{select ttl, type, host, mx_priority, case when lower(type)=’txt’ then concat(‘\”‘, data, ‘\”‘) else data end as mydata, resp_person, serial, refresh, retry, expire, minimum from dns_records where zone = ‘%zone%’}
{select zone from xfr_table where zone = ‘%zone%’ and client = ‘%client%’ limit 1}
{update data_count set count = count + 1 where zone =’%zone%’}”;
};

安装Mysql,安装到/usr/local/mysql/,安装步骤略…
建一个数据库dns
CREATE DATABASE dns;
建一个表dns_records

use dns;
CREATE TABLE dns_records (
zone varchar (255),
host varchar (255),
type varchar (255),
data varchar (255),
ttl int(11),
mx_priority varchar (255),
refresh int(11),
retry int(11),
expire int(11),
minimum int(11),
serial bigint(20),
resp_person varchar (255),
primary_ns varchar (255)
);

加入一条记录
INSERT INTO `dns_records` ( `zone` , `host` , `type` , `data` , `ttl` , `mx_priority`
, `refresh` , `retry` , `expire` , `minimum` , `serial` , `resp_person` , `primary_ns` ) VALUES ( ‘yemaosheng.com’, ‘*’, ‘A’, ‘192.168.0.1’, ‘800’, NULL , NULL , ’10’, NULL ,
NULL , NULL , NULL , NULL );

cp /usr/local/mysql/lib/mysql/libmysqlclient.so.15 /usr/lib/

启动Bind
./named -u root -g -d 1

转载请注明出处:http://yemaosheng.com

4 thoughts on “bind dlz 安装配置

  1. jack

    楼主您好.我按您做的启动失败,不知如何排错.
    日志如下:
    root@lemp ~]# /usr/local/bind/sbin/named -uroot -g -d 1
    02-Mar-2009 02:13:06.971 starting BIND 9.6.0-P1 -uroot -g -d 1
    02-Mar-2009 02:13:06.972 built with ‘–with-dlz-mysql’ ‘–enable-threads’ ‘–prefix=/usr/local/bind’
    02-Mar-2009 02:13:06.972 adjusted limit on open files from 1024 to 1048576
    02-Mar-2009 02:13:06.972 found 1 CPU, using 1 worker thread
    02-Mar-2009 02:13:06.973 using up to 4096 sockets
    02-Mar-2009 02:13:06.978 loading configuration from ‘/usr/local/bind/etc/named.conf’
    02-Mar-2009 02:13:06.980 using default UDP/IPv4 port range: [1024, 65535]
    02-Mar-2009 02:13:06.980 using default UDP/IPv6 port range: [1024, 65535]
    02-Mar-2009 02:13:06.989 no IPv6 interfaces found
    02-Mar-2009 02:13:06.990 listening on IPv4 interface lo, 127.0.0.1#53
    02-Mar-2009 02:13:06.992 listening on IPv4 interface eth0, 192.168.1.103#53
    02-Mar-2009 02:13:06.993 Loading ‘Mysql zone’ using driver mysql
    02-Mar-2009 02:13:06.997 mysql driver failed to create database connection after 4 attempts
    02-Mar-2009 02:13:06.997 SDLZ driver failed to load.
    02-Mar-2009 02:13:06.997 DLZ driver failed to load.
    02-Mar-2009 02:13:06.997 load_configuration: failure
    02-Mar-2009 02:13:06.997 loading configuration: failure
    02-Mar-2009 02:13:06.997 exiting (due to fatal error)

    感谢!

    • 注意以下信息
      02-Mar-2009 02:13:06.993 Loading ‘Mysql zone’ using driver mysql
      02-Mar-2009 02:13:06.997 mysql driver failed to create database connection after 4 attempts

  2. jerome

    你好. 我已经架好了 bind DLZ 正向解析没问题了,但不知道反向解析如何来做 

    谢谢..

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.