命名配置錯誤

命名配置錯誤

我目前正在研究 DNS,並在我的 centos6 虛擬機器中遇到以下錯誤。這是我正在關注的圖教學

  [root@server1 named]# sudo service named start
Starting named:
Error in named configuration:
zone example.tv/IN: has no NS records
zone example.tv/IN: not loaded due to errors.
_default/example.tv/IN: bad zone
rev.example.tv:1: unknown RR type '1.168.192.in-addr.arpa.'
zone 1.168.192.in-addr.arpa/IN: loading from master file rev.example.tv failed: unknown class/type
zone 1.168.192.in-addr.arpa/IN: not loaded due to errors.
_default/1.168.192.in-addr.arpa/IN: unknown class/type
zone localhost.localdomain/IN: loaded serial 0
zone localhost/IN: loaded serial 0
zone 1.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 0
zone 1.0.0.127.in-addr.arpa/IN: loaded serial 0
zone 0.in-addr.arpa/IN: loaded serial 0
                                                           [FAILED]
[root@server1 named]#

這是我的 fwd.example.tv 檔案:

$ORIGIN example.tv.
$TTL 86400
@       IN SOA server1.example.tv. root.example.tv. (
        2018021011;serial
3600; refresh
1800;retry
604800; expire
86400;min TTL
)
@IN     NS      server1.example.tv.
@IN     NS      server2.example.tv.
server1         IN      A       192.168.1.17
server2         IN      A       192.168.1.20

~
~

這是我的 rev.example.tv 檔案:

@ORIGIN 1.168.192.in-addr.arpa.
$TTL 86400
@       IN      SOA     server1.example.tv.     root.example.tv.(
2018021011; serial
3600; refresh
1800;retry
604800; expire
86400; minimum TTL
)



@IN NS server1.example.tv.
@IN NS server2.example.tv.
server1 A 192.168.1.17
server2 A 192.168.1.20
17 IN PTR server1.example.tv.
20 IN PTR server2.example.tv.
~
~

這是我的 /etc/named.conf 檔案:

Code: Select all
options {
       listen-on port 53 { 127.0.0.1; 192.168.1.17; };
        listen-on-v6 port 53 { ::1; };
        directory       "/var/named";
        dump-file       "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
        allow-query     { localhost; 192.168.1.0/24; };
        allow-transfer {localhost; 192.168.1.20; };
        recursion yes;

        dnssec-enable yes;
        dnssec-validation yes;
        dnssec-lookaside auto;
        /* Path to ISC DLV key */
        bindkeys-file "/etc/named.iscdlv.key";

        managed-keys-directory "/var/named/dynamic";
};

logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};
zone "." IN {
        type hint;
        file "named.ca";
};




zone "example.tv" IN{
        type master;

file "fwd.example.tv";
allow-update {none;};
};

zone "1.168.192.in-addr.arpa" IN{
type master;
file "rev.example.tv";
allow-update{none;};
};

include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";

答案1

使用named-checkconfnamed-checkzone檢查您的配置和區域文件。

劇透警告:@IN這不是有效的語法,它必須讀取@ IN.

答案2

我的問題的答案在於應該建立對我有用的區域文件的方式,因此我將我的工作解決方案發佈給將來面臨相同問題的其他人。我實際上錯過了添加 example.tv。在 fwd.example.tv 文件和 rev.example.tv 文件中以正確的方式 NS,所以這是我的工作解決方案。

保留區域的正確方法如下:

$ORIGIN example.tv.
$TTL 86400
@       IN SOA server1.example.tv. root.example.tv. (
2018021000
3600
1800
604800
86400
)

@               IN      NS      server1.example.tv.
@               IN      NS      server2.example.tv.

server1         IN      A       192.168.1.17
server2         IN      A       192.168.1.20
example.tv.     IN      A       192.168.1.17
~
~

保持反向區域的正確方法如下:

$ORIGIN 1.168.192.in-addr.arpa.
$TTL 86400
@       IN      SOA     server1.example.tv.     root.example.tv.(
2018021011; serial
3600; refresh
1800;retry
604800; expire
86400; minimum TTL
)



@       IN NS server1.example.tv.
@       IN NS server2.example.tv.
server1 A 192.168.1.17
server2 A 192.168.1.20
17 IN PTR server1.example.tv.
20 IN PTR server2.example.tv.
        IN      NS      example.tv.
1       IN      PTR     example.tv.
~

相關內容