bind dlz-mysql
key "rndc-key" { algorithm hmac-sha256;secret "vCQLvxUeXxvcdKkt8JSNI9p6eB+/ZE9DKg6Wyq1g7Uo=";
};
controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndc-key"; };
};
options {
listen-on port 53 { any; }; //开启侦听53端口,any表示接受任意ip连接
directory "/usr/local/bind/var";
pid-file "named.pid";//文件内容就是named进程的id
allow-query{ any; }; //允许任意ip查询
recursive-clients 30000;
forwarders{ 202.96.128.86;223.5.5.5; }; //设置转发的公网ip
max-cache-size 4g;
allow-query-cache { any; };
};
logging {
channel query_log { //查询日志
file "/var/log/named/query.log" versions 20 size 300m;
severity info;
print-time yes;
print-category yes;
};
channel error_log { //报错日志
file "/var/log/named/error.log" versions 3 size 10m;
severity info;
print-time yes;
print-severity yes;
print-category yes;
};
category queries { query_log; };
category default { error_log; };
};
dlz "Mysql zone" {
database "mysql
{host=172.16.1.24 dbname=bind_ui ssl=false port=3306 user=bind_ui_r pass=mysql_pass}
{select zone_name from DnsRecord_zonetag where zone_name = '$zone$'}
{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 from DnsRecord_zonetag inner join DnsRecord_record on DnsRecord_record.zone_tag_id = DnsRecord_zonetag.id and DnsRecord_zonetag.zone_name = '$zone$' and DnsRecord_record.host = '$record$' where DnsRecord_zonetag.status = 'on' and DnsRecord_record.status = 'on'}";
};
页:
[1]