域名服务器没有 A 记录

cow*_*god 3 domain-name-system bind dns-zone

我最近在我的 DNS 服务器上升级了 BIND,现在 DNS 不适用于我的任何网站。nslookup在超时中执行结果并dig在不同的服务器上使用告诉我查询中没有返回权威部分。dig但是,在服务器上本地使用会产生预期的结果。

我尝试了在DNSsy.com上找到的工具,它告诉我我的名称服务器没有 A 记录,根据我的区域文件,这似乎是不正确的。下面是我配置的区域文件之一(实际域名和 IP 地址被替换/屏蔽):

例子.com.zone

$ORIGIN example.com.
$TTL 1W
@       IN      SOA     ns.example.com. example.example.com.  (
                                      2011060701 ; Serial
                                      28800      ; Refresh
                                      14400      ; Retry
                                      604800     ; Expire - 1 week
                                      10800 )    ; Minimum
    IN  NS  ns
    IN  MX  10 mail

localhost IN A     127.0.0.1
@         IN A     x.x.x.x
ns        IN A     x.x.x.x
mail      IN A     x.x.x.x
www       IN CNAME @
Run Code Online (Sandbox Code Playgroud)

命名文件

acl "xfer" {
        none;
};

acl "trusted" {
        127.0.0.0/8;
        ::1/128;
};

options {
        directory "/var/bind";
        pid-file "/var/run/named/named.pid";

        listen-on-v6 { ::1; };
        listen-on { 127.0.0.1; };

        allow-query {
                trusted;
        };

        allow-query-cache {
                trusted;
        };

        allow-recursion {
                trusted;
        };

        allow-transfer {
                none;
        };

        allow-update {
                none;
        };

        forward first;
        forwarders {
                8.8.8.8;                // Google Open DNS
                8.8.4.4;                // Google Open DNS
        };
};

logging {
        channel default_log {
                file "/var/log/named/named.log" versions 5 size 50M;
                print-time yes;
                print-severity yes;
                print-category yes;
        };

        category default { default_log; };
        category general { default_log; };
};

include "/etc/bind/rndc.key";
controls {
        inet 127.0.0.1 port 953 allow { 127.0.0.1/32; ::1/128; } keys { "rndc-key"; };
};

zone "." in {
        type hint;
        file "/var/bind/root.cache";
};

zone "localhost" IN {
        type master;
        file "pri/localhost.zone";
        notify no;
};

zone "127.in-addr.arpa" IN {
        type master;
        file "pri/127.zone";
        notify no;
};

zone "x.x.x.in-addr.arpa" IN {
  type master;
  file "pri/x.x.x.zone";
  notify no;
};

zone "example.com" IN {
  type master;
  file "pri/example.com.zone";
  notify no;
};
Run Code Online (Sandbox Code Playgroud)

运行 named-checkconf 的输出

没有,我认为这意味着没关系。

运行命名检查区的输出

named-checkzone example.com /var/bind/pri/example.com.zone zone example.com/IN:加载序列号 2011060701 OK

Cak*_*mox 7

allow-query指令仅限于仅trusted包含 localhost的acl。这就是为什么您只能从本地主机获得响应的原因。您需要将其更改为任何。

还要注意listen-onlisten-on-v6节需要在其中包含 localhost 以外的 IP 地址 - 否则外部客户端将永远无法连接到您的名称服务器。