服务器找不到 NXDOMAIN

Ayo*_* Mk 10 dns centos

我只是想在本地配置 DNS 服务器我配置了 /etc/named.conf

options {
    listen-on port 53 {
            127.0.0.1; 192.168.220.135;
            };
    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.220.0/24;
            };
    allow-transfer{
            localhost; 192.168.220.136;
            };
    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";
    also-notify {
            };
    };
    logging {
    channel default_debug {
            file "data/named.run";
            severity dynamic;
    };
    };
    zone "." IN {
    type hint;
    file "named.ca";
    };
    zone "ayoub.local" IN {
    type master;
    file "direct.zone";
    #allow-update {none;};
    };
    zone "220.168.192.in-addr.arpa" IN {
    type master;
    file "inverse.zone";
    #allow-update {none;};};
    include "/etc/named.rfc1912.zones";
    include "/etc/named.root.key";
Run Code Online (Sandbox Code Playgroud)

和 /var/named/direct.zone

    **$TTL 3H
    @       IN SOA  MasterDNS.ayoub.local. root.ayoub.local. (
                                            20160421        ; serial
                                            1D              ; refresh
                                            1H              ; retry
                                            1W              ; expire
                                            3H )            ; minim
    @               IN      NS      MasterDNS.ayoub.local.
    @               IN      NS      SlaveDNS.ayoub.local.
    @               IN      A       192.168.220.135
    @               IN      A       192.168.220.136
    @               IN      A       192.168.220.137
    MasterDNS       IN      A       192.168.220.135
    SlaveDNS        IN      A       192.168.220.136
    Client          IN      A       192.168.220.137    
Run Code Online (Sandbox Code Playgroud)

和 /var/named/inverse.zone

     $TTL 3H
    @       IN SOA  MasterDNS.ayoub.local. root.ayoub.local. (
                                            20160418        ; serial
                                            1D              ; refresh
                                            1H              ; retry
                                            1W              ; expire
                                            3H )            ; minimum
    @               IN      NS      MasterDNS.ayoub.local.
    @               IN      NS      SlaveDNS.ayoub.local.
    @               IN      PTR     ayoub.local.
    MasterDNS       IN      A       192.168.220.135
    SlaveDNS        IN      A       192.168.220.136
    Client          IN      A       192.168.220.137
    135             IN      PTR     MasterDNS.ayoub.local.
    136             IN      PTR     SlaveDNS.ayoub.local.
    137             IN      PTR     Client1.ayoub.local.
Run Code Online (Sandbox Code Playgroud)

和 /etc/resolv.conf

domain ayoub.local
search ayoub.local
nameserver 127.0.0.1
nameserver 192.168.220.136
Run Code Online (Sandbox Code Playgroud)

当我用 nslookup 测试域名时

;; Got SERVFAIL reply from 127.0.0.1, trying next server
;; connection timed out; trying next origin
;; Got SERVFAIL reply from 127.0.0.1, trying next server
;; connection timed out; no servers could be reached
Run Code Online (Sandbox Code Playgroud)

当我设置 /etc/resolv.conf 时

search localdomain
nameserver 192.168.220.2
Run Code Online (Sandbox Code Playgroud)

我看到 nslookup 的结果

Server:         192.168.220.2
Address:        192.168.220.2#53

** server can't find ayoub.local: NXDOMAIN
Run Code Online (Sandbox Code Playgroud)

Dav*_*orp 7

有时由于名称服务器127.0.0.1会发生错误

因此,在resolve.conf中使用以下名称服务器或您喜欢的任何其他名称服务器。

这是我的resolve.conf 文件

nameserver 8.8.8.8
nameserver 1.1.1.1
Run Code Online (Sandbox Code Playgroud)


Ayo*_* Mk 1

我解决了这个问题。我只是忘记直接换组了。 zone 和 inverse.zone 从根到命名,命令是:

chgroup named /var/named/direct.zone
Run Code Online (Sandbox Code Playgroud)

我强制决定不通过 DHCP 进行更改:

chattr +i /etc/resolv.conf
Run Code Online (Sandbox Code Playgroud)