我已经安装了全新的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
当我尝试启动named守护进程时,出现以下错误:
[root@srv ~]# service named restart Stopping named: [ OK ] Starting named: Error in named configuration: /etc/named.conf:9: unknown key 'rndckey' [FAILED] [root@srv ~]#
我不明白我在做什么错,我已经创build了rndc.key使用下一个命令: rndc-confgen -a -c /etc/rndc.key ,它创build了密钥,但我仍然得到相同的错误。 该文件存在于正确的path: /etc/rndc.key ,它包含在/etc/named.conf文件中。
检查文件/etc/rndc.key并查看哪个是密钥的名称。 例如:
key "rndc-key" {
这个名字应该在named.conf指定
keys { rndc-key; };
我刚刚经历了上述症状。
虽然我的情况略有不同,这不是上述问题的确切答案,希望这可能有助于某人出…
在我的情况下,我已经指定了不正确的选项块内的关键。
关键语句必须在named.confconfiguration文件中的任何其他语句(如选项语句块)之外定义。
即以下是不正确的 :
options { ... include "/etc/rndc.key"; };
以下是正确的:
options { ... }; include "/etc/rndc.key";