Rhel5中Bind9服务启动失败的排错过程

Rhel5中Bind9服务启动失败的排错过程,其他系统也同样可以参考。。。。

[root@xyz etc]# service named start
Starting named:
Error in named configuration:
/etc/named.conf:58: open: /etc/named.root.hints: file not found
                                                           [FAILED]
没有找到文件,那就复制一个过来吧。要安装caching-nameserver-9.3.4-6.P1.el5.i386.rpm,才会有这些样本文件
[root@xyz etc]# cp /usr/share/doc/bind-9.3.4/sample/etc/named.root.hints /etc
[root@xyz etc]# service named start
Starting named:
Error in named configuration:
/etc/named.rfc1912.zones:10: zone '.': already exists previous definition: /etc/named.root.hints:12
zone localdomain/IN: loaded serial 42
zone localhost/IN: loaded serial 42
zone 0.0.127.in-addr.arpa/IN: loaded serial 1997022700
zone 0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa/IN: loaded serial 1997022700
zone 255.in-addr.arpa/IN: loaded serial 42
zone 0.in-addr.arpa/IN: loaded serial 42
zone my.internal.zone/IN: loading master file my.internal.zone.db: file not found
internal/my.internal.zone/IN: file not found
zone my.ddns.internal.zone/IN: loading master file slaves/my.ddns.internal.zone.db: file not found
internal/my.ddns.internal.zone/IN: file not found
zone my.external.zone/IN: loading master file my.external.zone.db: file not found
external/my.external.zone/IN: file not found
                                                           [FAILED]

启动失败的原因是定义了不存在的zone
vi /etc/named.conf 删除或者注释不存在的zone(my.internal.zone,my.slave.internal.zone,my.ddns.internal.zone,my.external.zone)

[root@xyz etc]# service named start
Starting named:                                            [FAILED]
没有更详细的错误输出了,使用named -d 3 -f -g获得调试信息
[root@xyz etc]# named -d 3 -f -g
信息太长,截去成功的部分
31-Mar-2010 21:48:20.866 could not configure root hints from 'named.root': file not found
31-Mar-2010 21:48:20.867 load_configuration: file not found
31-Mar-2010 21:48:20.867 loading configuration: file not found
31-Mar-2010 21:48:20.867 exiting (due to fatal error)
在named.conf里有指令include "/etc/named.root.hints",其中用到文件named.root,复制一个到/var/named目录
[root@xyz etc]# cat /etc/named.root.hints
//
//   The 'named.root' root cache hints zone for the bind DNS 'named' nameserver.
//
//   named's cache must be primed with the addresses of the root zone '.' nameservers.
//   The root zone file can be obtained by querying the root 'A' nameserver:
//     $ dig . ns @198.41.0.4 > named.root
//   Or by download via FTP / HTTP:
//     $ wget ftp://ftp.rs.internic.net/domain/named.root
//
//   Every view that is to provide recursive service must include this zone.
//
zone "." IN {
        type hint;
        file "named.root";

[root@xyz named]# cp /usr/share/doc/bind-9.3.4/sample/var/named/named.root /var/named

[root@xyz named]# service named start
Starting named:                                            [FAILED]
还是启动失败,再看调试信息
[root@xyz named]# named -d 3 -f -g
依然是截去了部分无用的信息
31-Mar-2010 21:53:32.197 view.c:601: REQUIRE(view->hints == ((void *)0)) failed
31-Mar-2010 21:53:32.197 exiting (due to assertion failure)
Aborted (core dumped)

看来问题是与hints有关的
named.conf里定义了两个包含文件
include "/etc/named.rfc1912.zones"
include "/etc/named.root.hints"
这两个文件中都对zone "."进行了重复的定义
把/etc/named.rfc1912.zones中的zone "."给注释掉
//zone "." IN {
//      type hint;
//      file "named.ca";
//};

[root@xyz etc]# service named start
Starting named:                                            [FAILED]
崩溃,还是不成功
[root@xyz etc]# named -d 3 -f -g

31-Mar-2010 22:00:24.786 /etc/named.conf:101: configuring key 'ddns_key': bad base64 encoding
31-Mar-2010 22:00:24.786 res 0x8d24200: shutdown
31-Mar-2010 22:00:24.786 res 0x8d24200: exiting
31-Mar-2010 22:00:24.787 dns_requestmgr_shutdown: 0x8d3b758
31-Mar-2010 22:00:24.787 send_shutdown_events: 0x8d3b758
31-Mar-2010 22:00:24.787 load_configuration: bad base64 encoding
31-Mar-2010 22:00:24.787 loading configuration: bad base64 encoding
31-Mar-2010 22:00:24.787 exiting (due to fatal error)
31-Mar-2010 22:00:24.787 client @0x8d0e5e0: udprecv
31-Mar-2010 22:00:24.788 client @0x8d102c0: udprecv
31-Mar-2010 22:00:24.788 client @0x8d12168: accept
31-Mar-2010 22:00:24.788 client @0x8d14368: udprecv
31-Mar-2010 22:00:24.788 client @0x8d160a8: udprecv
31-Mar-2010 22:00:24.788 client @0x8d182c0: udprecv
31-Mar-2010 22:00:24.788 client @0x8d1a000: udprecv
31-Mar-2010 22:00:24.788 client @0x8d1bea8: accept
31-Mar-2010 22:00:24.788 zone_shutdown: zone 0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa/IN/localhost_resolver: shutting down
31-Mar-2010 22:00:24.788 zone_shutdown: zone 0.in-addr.arpa/IN/localhost_resolver: shutting down
原来是rndc的key没有设置
[root@xyz named]# cat /etc/rndc.key
key "rndckey" {
        algorithm       hmac-md5;
        secret          "Jopf1G5nzm8OL96CxkMI4bfjHPsT1uvLVMUIG7TjvHWuFzlCTH2veCu9Ht4w";
};
把secret复制到named.conf,或者自己用dns-keygen生成一个密钥
vi named.conf
//      secret "use /usr/sbin/dns-keygen to generate TSIG keys";
        secret "Jopf1G5nzm8OL96CxkMI4bfjHPsT1uvLVMUIG7TjvHWuFzlCTH2veCu9Ht4w";
[root@xyz etc]# service named start
Starting named:                                            [  OK  ]

原文:http://hi.baidu.com/jwl091/blog/item/78840c8f30e123a40e244473.html

你可能感兴趣的:(bind,休闲,named,DNS故障,ddns_key)