免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 12946 | 回复: 13
打印 上一主题 下一主题

[DNS] 使用bind9 的rndc 控制dns [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2004-01-11 12:21 |只看该作者 |倒序浏览
      

首先在这里感谢:阿骁,yfhe, 網中人 版主的帮忙..


使用bind9 的rndc 控制dns

在bind8 是由ndc控制dns ,最近由于传出bind8有漏洞 所以偶把deinstall, 升

到9.0 .而9.0是由rndc 来控制dns从新加载配置文件等等,下面就把小弟的配置文

档写出来.由于是菜鸟,哪地方不足还请高手请点!!!


本例中.Freebsd4.9+bind8+hcpost.com 域名 待升到bind9.2.3


首先我下载了一个最新的bind9.2.3.tar.gz.到/home/里


freebsd# tar zxvf bind9.2.3.tar.gz -C /usr/local

freebsd# cd bind9.2.3

freebsd# ./configure   ---->;我没有prefix= 装的,默认启动文件在/usr/local/sbin里


freebsd# make

freebsd# make install

到此,bind9 已经安装完成.看一看版本现版本是多少.


freebsd# /usr/local/sbin/named -v

BIND 9.2.3


我的named.conf 配置文档在/etc/namedb 文件里. bind9 规定,如果要使用

rndc 来控制dns

必须先生成验证文件.rndc.conf 和密锁.


****注:这部最重要了.


freebsd# /usr/local/sbin/rndc-confgen >; /etc/rndc.conf 生成这个文件按你--prefix 而定.

(freebsd# /usr/local/sbin/named -g
Jan 11 11:56:45.075 starting BIND 9.2.3 -g
Jan 11 11:56:45.076 using 1 CPU
Jan 11 11:56:45.079 loading configuration from '/etc/named.conf'

用这一条确定.你应该把/rndc.conf 生成到目录下.)

注:好象freebsd 要生成rndc.conf 文件.必须在/etc/rc.conf 加这一条,要不然.运行rndc-confgen屏目就一直不动了.解决方法是在/etc/rc.conf 加入

rand_irqs="3 14 15"

然后,

freebsd# /etc/netstart 从新加载rc.conf 文件,如果netstart不行.就reboot

生成的rndc.conf 大至如下.

freebsd# /usr/local/sbin/rndc-confgen
# Start of rndc.conf
key "rndc-key" {
        algorithm hmac-md5;
        secret "Cm9Lc0JG5wJcsoRj3PbKqw==";
};

options {
        default-key "rndc-key";
        default-server 127.0.0.1;
        default-port 953;
};
# End of rndc.conf

# Use with the following in named.conf, adjusting the allow list as needed:
# key "rndc-key" {
#       algorithm hmac-md5;
#       secret "Cm9Lc0JG5wJcsoRj3PbKqw==";
# };
#
# controls {
#       inet 127.0.0.1 port 953
#               allow { 127.0.0.1; } keys { "rndc-key"; };
# };
# End of named.conf


打开刚在/etc/rndc.conf 文件.打# Use with the following in named.conf, adjusting the allow list as needed:
这行下的所有复制到

你的named.conf 文件里

偶的是.

freebsd# cat /etc/namedb/named.conf
options {
        directory "/etc/namedb";
        notify  yes;
        allow-transfer  { 218.24.233.11; };---->;>;这个是只转发到我辅dns 上.
};

# Use with the following in named.conf, adjusting the allow list as needed:
key "rndc-key" {
       algorithm hmac-md5;
       secret "5hhmFj6S3Pn6EoDnOvlblg==";
};

controls {
       inet 127.0.0.1 port 953
               allow { 127.0.0.1; } keys { "rndc-key"; };
};
# End of named.conf

zone "." {
        type hint;
        file "named.root";
};

zone "0.0.127.IN-ADDR.ARPA" {
        type master;
        file "localhost.rev";
};


zone "hcpost.com" {
        type master;
        file "/etc/namedb/hosts/hcpost.com.hosts";
};

zone "233.24.218.in-addr.arpa" {
        type master;
        file "/etc/namedb/rev/218.24.233.rev";
};



完成,最后启动bind9 .

freebsd# /usr/local/sbin/named -c /etc/namedb/named.conf

测试rndc是否成功


freebsd# rndc status
number of zones: 5
debug level: 0
xfers running: 0
xfers deferred: 0
soa queries in progress: 0
query logging is OFF
server is up and running

出现如下.代表rndc 已经成功控制bind9


如果想启动就加载.

可以在/usr/local/etc/rc.d/ 写一个.sh 脚本文件,小弟就简单了.


vi /usr/local/etc/rc.d/startbind.sh
加入
#!/bin/sh
/usr/local/sbin/named -c /etc/namedb/named.conf


呵呵,就这么简单.

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
2 [报告]
发表于 2004-01-11 23:17 |只看该作者

使用bind9 的rndc 控制dns

感謝分享﹗ 鼓勵原創﹗

论坛徽章:
0
3 [报告]
发表于 2004-01-12 08:50 |只看该作者

使用bind9 的rndc 控制dns

rc.conf 是rndc.conf吧 疑惑

论坛徽章:
0
4 [报告]
发表于 2004-01-12 12:10 |只看该作者

使用bind9 的rndc 控制dns

美文~ 收藏之

论坛徽章:
0
5 [报告]
发表于 2004-01-12 12:13 |只看该作者

使用bind9 的rndc 控制dns

to:liuyanbo     rc.conf 是rndc.conf吧

rc.conf    freebsd下的/etc/rc.conf 下的配置文件

请看: rndc-confgen 一直停时.需要在/etc/rc.conf 加这行参数.

Q: I have Freebsd 4.4 and "rndc-confgen -a" just sits there.

A: /dev/random is not configured.  Use rndcontrol( to tell the kernel
to use certain interrupts as a source of random events.  You can make this
permanent by setting rand_irqs in /etc/rc.conf.

e.g.
        /etc/rc.conf
        rand_irqs="3 14 15"

论坛徽章:
0
6 [报告]
发表于 2004-01-12 14:21 |只看该作者

使用bind9 的rndc 控制dns

不错,先收下了

论坛徽章:
0
7 [报告]
发表于 2004-01-12 19:48 |只看该作者

使用bind9 的rndc 控制dns

rndc.key如何生成?
named.conf文件中 key "rndc-key" {
       algorithm hmac-md5;
       secret "5hhmFj6S3Pn6EoDnOvlblg==";
和# /usr/local/sbin/rndc-confgen
# Start of rndc.conf
key "rndc-key" {
        algorithm hmac-md5;
        secret "Cm9Lc0JG5wJcsoRj3PbKqw==";
};
中的key值为什么不一样?
我应该先做:
1./usr/local/sbin/rndc-confgen >; /etc/rndc.conf
2.  /usr/local/sbin/rndc-confgen
然后将2步生成的key值复制到named.conf文件中。
我用的是solaris9,刚从linux转型过来,请不吝赐教

论坛徽章:
0
8 [报告]
发表于 2004-01-14 10:44 |只看该作者

使用bind9 的rndc 控制dns

rndc dumpdb试过可以吗?我在家里的试的总是不行

论坛徽章:
0
9 [报告]
发表于 2006-12-15 21:28 |只看该作者
脚印子

论坛徽章:
1
技术图书徽章
日期:2013-12-05 23:25:45
10 [报告]
发表于 2007-01-06 20:49 |只看该作者
原帖由 yj11 于 2004-1-14 10:44 发表
rndc dumpdb试过可以吗?我在家里的试的总是不行


我测试了可以。
现在还是在windowsxp上面测试的:
        dump-file       "D:\\usr\\local\\named\\etc\\data\\cache_dump.db";

这个设置正确了么。

不过对本文,我有一点点小的意见。

本文对于rndc真真的控制功能说的很少,主要是讲配置。
实际上,配置并不复杂。

具体如何控制,没有讲。

当然rndc执行,直接给出了帮助文档。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP