Centos BIND 服务器:无法启动命名守护进程

Centos BIND 服务器:无法启动命名守护进程

我安装了一个新的 Centos 服务器,并在其中安装了 bind 和 bind-utils。内容/etc/named.conf如下:

# create new
 options {
    directory "/var/named";
    allow-query { localhost; 10.1.2.0/24; };
    allow-transfer { localhost; 10.1.2.0/24; };
    recursion yes;
};
controls {
    inet 127.0.0.1 allow { localhost; } keys { rndckey; };
};
view "internal" {
    match-clients {
        localhost;
        10.1.2.0/24;
    };
    zone "." IN {
        type hint;
        file "named.ca";
    };
    zone "amadeus.netvision" IN {
        type master;
        file "amadeus.netvision.lan";
        allow-update { none; };
    };
    zone "0.0.10.in-addr.arpa" IN {
        type master;
        file "0.0.10.db";
        allow-update { none; };
    };
    zone "localdomain" IN {
        type master;
        file "localdomain.zone";
        allow-update { none; };
    };
    zone "localhost" IN {
        type master;
        file "localhost.zone";
        allow-update { none; };
    };
    zone "0.0.127.in-addr.arpa" IN {
        type master;
        file "named.local";
        allow-update { none; };
    };
    zone "255.in-addr.arpa" IN {
        type master;
        file "named.broadcast";
        allow-update { none; };
    };
    zone "0.in-addr.arpa" IN {
        type master;
        file "named.zero";
        allow-update { none; };
    };
};
view "external" {
    match-clients { any; };
    allow-query { any; };
    recursion no;
    zone "amadeus.netvision" IN {
        type master;
        file "amadeus.netvision.wan";
        allow-update { none; };
    };
};
include "/etc/rndc.key";

# allow-query ⇒ query range you permit
# allow-transfer ⇒ the range you permit to transfer zone info
# recursion ⇒ allow or not to search recursively
# view "internal" { *** }; ⇒ write for internal definition
# view "external" { *** }; ⇒ write for external definition
# For How to write for reverse resolving, Write network address reversely like below.
# 10.1.2.0/24
# network address⇒ 10.1.2.0
# range of network⇒ 10.1.2.0 - 10.0.0.255
# how to write⇒ 0.0.10.in-addr.arpa
# 172.16.0.80/29
# network address⇒ 172.16.0.80
# range of network⇒ 172.16.0.80 - 172.16.0.87
# how to write⇒ 80.0.16.172.in-addr.arpa

当我尝试启动命名守护程序时出现以下错误:

[root@srv ~]# service named restart
Stopping named:                                            [  OK  ]
Starting named: 
Error in named configuration:
/etc/named.conf:9: unknown key 'rndckey'
                                                           [FAILED]
[root@srv ~]#

我不明白我做错了什么,我使用下一个命令创建了 rndc.key: rndc-confgen -a -c /etc/rndc.key并且它创建了密钥,但我仍然收到相同的错误。该文件位于正确的路径中:/etc/rndc.key并且它包含在/etc/named.conf文件中。

答案1

检查文件/etc/rndc.key并查看密钥的名称。例如:

key "rndc-key" {

此名称应在named.conf

keys { rndc-key; };

答案2

我刚刚经历了上述症状。

虽然我的情况略有不同,而且这并不是上述问题的确切答案,但希望这可以为某些人提供帮助......

就我而言,我在选项块内指定的键是不正确的。

钥匙语句必须在任何其他语句(例如选项语句块)之外定义命名配置文件配置文件。

即以下是不正确

options {
    ...
    include "/etc/rndc.key";
};

以下说法正确:

options {
    ...
};        
include "/etc/rndc.key";

相关内容