bind dlz mysql的配置

[/code]部分配置
配置文件name.conf
[code="java"]
logging {
channel query_log {
file "/byread/logs/bind/query.log" versions 3 size 20m;
severity info;
print-time yes;
print-category yes;
};
category queries {
query_log;
};



include "/byread/bin/bind/etc/cmcc.ip";
include "/byread/bin/bind/etc/tel.ip";
include "/byread/bin/bind/etc/cnc.ip";
include "/byread/bin/bind/etc/view.conf";


[code="java"]
# more cmcc.ip
acl "cmcc" {
36.128.0.0/10;
111.0.0.0/10;
112.0.0.0/10;
117.128.0.0/10;
120.192.0.0/10;
121.36.0.0/16;
121.37.0.0/16;
183.192.0.0/10;
202.0.176.0/22;
202.70.0.0/19;
203.86.0.0/19;
203.128.96.0/19;
211.103.0.0/17;
211.136.0.0/14;
211.140.0.0/15;
211.142.0.0/17;
211.142.128.0/17;
211.143.0.0/16;
218.200.0.0/14;
218.204.0.0/15;
218.206.0.0/15;
220.231.128.0/17;
221.130.0.0/15;
221.176.0.0/13;
223.64.0.0/10;
};
[/code]

[code="java"]
# more view.conf
view "cmcc_view" {

match-clients { cmcc; };
allow-query-cache { any; };
allow-recursion { any; };
allow-transfer { none; };
recursion yes;

dlz "Mysql zone" {
database "mysql
{host=****** dbname=****** ssl=false port=****** user=****** pass=****** }
{select zone from dns_records where (( host='@' and zone = '$zone$' ) or (host!='@' and type='NS' and concat(host,'.',zone)='$zone$' )) and view='cmcc' limit 1}
{select ttl, type, mx_priority, case when lower(type)='txt' then concat('\"', data, '\"') else data end as data from dns_records where zone = '$zone$' and host = '$record$' and view='cmcc' and type <> 'NS' and type <> 'SOA'}
{select ttl, type, data, resp_person, serial, refresh, retry, expire, minimum from dns_records where ((host = '@' and zone = '$zone$') OR (host != '@' and concat(host,'.',zone) = '$zone$')) and (type = 'SOA' OR type='NS') order by typ
e='SOA' desc}
{select ttl, type, host, mx_priority, case when lower(type)='txt' then concat('\"', data, '\"') else data end as data, resp_person, serial, refresh, retry, expire, minimum from dns_records where zone = '$zone$' and view='cmcc' and typ
e <> 'NS' and type <> 'SOA'}
{select zone from xfr_table where zone = '$zone$' and client = '$client$' and view='cmcc' limit 1}
{update data_count set count = count + 1 where zone ='$zone$' and view='cmcc'}";
};

};
[/code]


dns_records表记录

INSERT INTO `dns_records` VALUES
(27,'client.byread.com','@','A','61.155.8.68',3600,'tel','',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2011-03-17 11:13:06','1'),
(28,'client.byread.com','@','A','111.1.37.147',3600,'cmcc','',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2011-03-17 11:14:27','1'),
(29,'client.byread.com','@','A','122.192.36.71',3600,'cnc','',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2011-03-17 11:14:38','1'),
(30,'client.byread.com','sukai','A','61.155.8.68',3600,'tel','',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2011-03-15 14:50:46','1'),
(31,'client.byread.com','sukai','A','111.1.37.147',3600,'cmcc','',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2011-03-15 14:51:01','1'),
(32,'client.byread.com','sukai','A','122.192.36.71',3600,'cnc','',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2011-03-15 14:51:32','1'),
(34,'client.byread.com','@','NS','ns.client.byread.com.',3600,'tel','',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2011-03-18 15:45:45','1'),
(35,'client.byread.com','ns','A','61.155.236.134',3600,'tel','',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2011-03-18 15:45:57','1'),
(36,'client.byread.com','@','SOA','ns.client.byread.com.',3600,'tel',NULL,10800,900,691200,50000,2011032009,'ycsk02.hotmail.com.',NULL,NULL,NULL,NULL),
(39,'client.byread.com','ns','A','61.155.236.134',3600,'cnc','',10800,900,604800,600,NULL,NULL,NULL,NULL,'2011-03-18 15:46:06','1'),
(40,'client.byread.com','ns','A','61.155.236.134',3600,'cmcc','',10800,900,604800,600,NULL,NULL,NULL,NULL,'2011-03-18 15:46:28','1');



遇到过的问题:

17-Mar-2011 13:00:39.689 client 211.137.96.204#55644: view cmcc_view: query (cache) 'client.byread.com/A/IN' denied



17-Mar-2011 13:00:23.390 mysql driver unable to return result set for findzone query


Mar 12 09:45:10 dns_telecom named[13397]: dns_rdata_fromtext: buffer-0x43e14410:1: near eof: unexpected end of input
Mar 12 09:45:10 dns_telecom named[13397]: dns_sdlz_putrr returned error. Error code was: unexpected end of input


参考文档:
[url]http://yemaosheng.com/?p=260[/url]
[url]http://bbs.linuxtone.org/thread-8055-1-1.html[/url]
[url]http://blog.gmane.org/gmane.network.dns.bind9.dlz/month=20090201[/url]
[url]http://blog.gmane.org/gmane.network.dns.bind9.dlz/month=20050601[/url]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值