Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7430648
  • 博文数量: 1758
  • 博客积分: 18684
  • 博客等级: 上将
  • 技术积分: 16252
  • 用 户 组: 普通用户
  • 注册时间: 2010-06-02 10:28
个人简介

啥也没写

文章分类

全部博文(1758)

文章存档

2024年(4)

2023年(44)

2022年(39)

2021年(46)

2020年(43)

2019年(27)

2018年(44)

2017年(50)

2016年(47)

2015年(15)

2014年(21)

2013年(43)

2012年(143)

2011年(228)

2010年(263)

2009年(384)

2008年(246)

2007年(30)

2006年(38)

2005年(2)

2004年(1)

分类: LINUX

2008-03-04 11:38:12

bind-9.4.2已经自带的DLZ,所以安装的时候非常简单
tar -zxvf bind-9.4.2.tar.gz
cd bind-9.4.2
./configure --with-dlz-mysql --enable-threads=no --prefix=/usr/local/bind-dlz
make;make
就可以完成了,中间出现过有些字段出错,但最后还是过去了,
cd /usr/local/bind-dlz/sbin
./rndc-confgen -a
./rndc-confgen >../etc/rndc.conf
tail -10 rndc.conf |head -9 |sed s/#\ //g >named.conf
cd ..;cd etc
cat >>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
 
 
再named.conf加入以下内容:
[root@localhost etc]# cat named.conf
options {
version "akindns-ICP";
recursion no;
};
key "rndc-key" {
        algorithm hmac-md5;
        secret "cEPUadafJTtnG0Moxdhz+w==";
};
controls {
        inet 127.0.0.1 port 953
                allow { 127.0.0.1; } keys { "rndc-key"; };
};
dlz "Mysql zone" {
   database "mysql
   {host=127.0.0.1 dbname=nn_dns_data ssl=false port=3306 user=root pass=root }
   {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%'}";
};
#include "/usr/local/bind-dlz/etc/rndc.key";
[root@localhost etc]#
再建一个数据库nn_dns_data,建一个表dns_records
CREATE DATABASE nn_dns_data;
use nn_dns_data;
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 ( 'hibelle.cn', '*', 'A', '192.168.1.1', '800', NULL , NULL , '10', NULL ,
NULL , NULL , NULL , NULL );
 
./named -u root -g -d 1
结果少了,libmysqlclient.so.15,,查找到在MYSQL的目录,将它复制到/USR/LIB就OK了
cp /usr/local/mysql/lib/mysql/libmysqlclient.so.15 /usr/lib/
这样就OK了,再运行
/usr/local/bind-dlz/sbin/named -u root -g -d 1
完成,再试一下,再运NSLOOKUP
[root@localhost ~]# nslookup
> server 127.0.0.1
Default server: 127.0.0.1
Address: 127.0.0.1#53
>
Server:         127.0.0.1
Address:        127.0.0.1#53
Name:  
Address: 192.168.1.1
> alsdkfj.hibelle.cn
Server:         127.0.0.1
Address:        127.0.0.1#53
Name:   alsdkfj.hibelle.cn
Address: 192.168.1.1
> sasdfasfasf.hibelle.cn
Server:         127.0.0.1
Address:        127.0.0.1#53
Name:   sasdfasfasf.hibelle.cn
Address: 192.168.1.1
>
完成,,后两个我随便写的,都能解释到192.168.1.1,因为那个加入的数据,是泛解释的,所以。。。。。
搞定!
接下来。再摘定VIEW,,!

 
阅读(1483) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2008-04-22 13:13:27

请问反向解析能不能放在另外一格表中呢?