用了Bind-DLZ 有View功能,目前公司里自己在用,因为单位暂时没那么多资源,只设置了电线和网通线路,默认都是电线,需要其他资源的需要修改小数据库。添加了一些小 功能,可以查看当前bind的运行状态,以及域名信息,如果down了会有显示,以后有时间应该会陆续添加一些小功能,方便管理DNS,因为很喜欢做界 面,也会多多美化下。我已经修改成通用版本了,可以正常使用。bind-dlz 安装请查看相关文档,我稍后会把这里的配置传上来。下一個版本將添加清理緩存的功能和控制bind服務啟動的功能。

mycdn.rar (218.03 KB, 下载次数: 147)

2010-11-19 16:35 上传
下载次数: 147


namede.conf文件的代碼(開了遞歸,因為現在機器在內網):


key "rndc-key" {
algorithm hmac-md5;
secret "gOszdwp5stjsnfI7MybyIg==";
};

controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndc-key"; };
};

options{
directory "/usr/local/bind/etc";
forwarders {202.96.209.133;};
pid-file "/usr/local/bind/etc/named.pid";
statistics-file "/usr/local/bind/etc/named.stats";
recursion yes;
allow-query {any;};
allow-transfer {any;};
};

logging {
channel bind_info {
file "/var/log/bind.log" versions 20 size 20m;
print-category yes;
print-time yes;
severity notice;
};
category default {
bind_info;
};
};


include "/usr/local/bind/etc/view.conf";
include "/usr/local/bind/etc/cnc.acl";
复制代码




view.conf部份的代碼:


#cnc-view
VIEw "cnc_view" {
match-clients { CNC; };
allow-query-cache { ANY; };
allow-recursion { ANY; };
allow-transfer { ANY; };
recursion yes;

dlz "Mysql zone" {
database "mysql
{host=127.0.0.1 dbname=dns ssl=false port=3306 user=root pass=Mm123456}
{select zone from dns_records where zone = '$zone$' and view='CNC' limit 1}
{select ttl, type, mx_priority, case when lower(type)='txt' then concat('\"', data, '\"')
else data end from dns_records where zone = '$zone$' and view='CNC' and host = '$record$'
and not (type = 'SOA' or type = 'NS')}
{select ttl, type, mx_priority, data, resp_person, serial, refresh, retry, expire, minimum
from dns_records where zone = '$zone$' and (type = 'SOA' or type='NS')}
{select ttl, type, host, mx_priority, data, resp_person, serial, refresh, retry, expire,
minimum from dns_records where zone = '$zone$' and view='CNC' and not (type = 'SOA' or type = 'NS')}
{select zone from xfr_table where zone = '$zone$' and view='CNC' and client = '$client$'}
{update data_count set count = count + 1 where zone ='$zone$'}";
};
zone "." IN {
type hint;
file "named.root";
};
};
#cnc-view
view "any_view" {
match-clients { ANY; };
allow-query-cache { ANY; };
allow-recursion { ANY; };
allow-transfer { ANT; };

dlz "Mysql zone" {
database "mysql
{host=127.0.0.1 dbname=dns ssl=false port=3306 user=root pass=Mm123456}
{select zone from dns_records where zone = '$zone$' and view='TELCOM' limit 1}
{select ttl, type, mx_priority, case when lower(type)='txt' then concat('\"', data, '\"')
else data end from dns_records where zone = '$zone$' and view='TELCOM' and host = '$record$'
and not (type = 'SOA' or type = 'NS')}
{select ttl, type, mx_priority, data, resp_person, serial, refresh, retry, expire, minimum
from dns_records where zone = '$zone$' and (type = 'SOA' or type='NS')}
{select ttl, type, host, mx_priority, data, resp_person, serial, refresh, retry, expire,
minimum from dns_records where zone = '$zone$' and view='TELCOM' and not (type = 'SOA' or type = 'NS')
}
{select zone from xfr_table where zone = '$zone$' and view='TELCOM' and client = '$client$'}
{update data_count set count = count + 1 where zone ='$zone$'}";
};
zone "." IN {
type hint;
file "named.root";
};
};
复制代码




安装方法:


修改 config/config.php  里面的mysql连接参数


默认用户名: admin1 密码admin1



4.jpg
2010-11-19 16:38 上传
下载附件 (159.58 KB)

3.jpg
2010-11-19 16:37 上传
下载附件 (83.87 KB)

2.jpg
2010-11-19 16:34 上传
下载附件 (129.14 KB)

1.jpg
2010-11-19 16:33 上传
下载附件 (62.45 KB)








转http://bbs.linuxtone.org/thread-8055-1-1.html