bind9 配置连接超时

3 networking dns

我正在尝试在没有 8.8.8.8 或 8.8.4.4 的情况下制作自己的名称服务器。我一开始就设置好了,但我不知道哪里出错了,我得到的只是

;; 连接超时; 无法访问任何服务器

这是我的区域文件

zone "my-new-place.com" IN {
type master;
file "/etc/bind/my-new-place.com";
};
Run Code Online (Sandbox Code Playgroud)

这是我的/etc/resolv.conf文件,我使用 888 作为我的 eth0 ipv4

search my-new-place.com
nameserver 192.168.1.888
Run Code Online (Sandbox Code Playgroud)

这是我的域名服务器文件

$TTL 864
@ IN SOA k.my-new-place.com root.my-email.com (
 2
 3600
 900
 604800
 864
)
@ IN NS k.my-new-place.com

k.my-new-place.com IN A 89.31.143.1
Run Code Online (Sandbox Code Playgroud)

这是我的控制文件 /etc/bind/named.conf.options

ACL bindMe {
192.168.1.0/24;
};

options {
directory "/var/cache/bind";
listen-on port 53 { 192.168.1.888; 127.0.0.1; };
allow-query { localhost; bindMe; };
forwarders { 192.168.1.1; };
recursion yes;
};
Run Code Online (Sandbox Code Playgroud)

ear*_*Lon 6

我并不完全清楚发生了什么。我想由于您的配置错误,bind没有运行,因此无法访问。如果这没有帮助,请编辑您的帖子以包含您正在运行的命令和其他输出。

当您与 互动时bind,您使用systemctl? 例如:

systemctl restart bind9
Run Code Online (Sandbox Code Playgroud)

执行此操作时,该命令是否会吐出任何错误?通常,当出现问题时,它会引导您查看journalctl. 什么系统告诉你错了?

您可以使用systemctl status bind9、 或ps aux | grep named以及可能的来检查绑定是否正在运行rndc status

也许您有/etc/bind/named.conf.local正确的,但您没有发布,所以请确保您在该文件中有区域条目。每个域需要一个,每个子网需要一个:

zone "example.tld" {
    type master;
    file "/etc/bind/zones/example.tld.zone";
};

zone "1.168.192.in-addr.arpa" {
    type master;
    file "/etc/bind/zones/192.168.1.zone";
};
Run Code Online (Sandbox Code Playgroud)

这是一个有效的/etc/bind/named.conf.options但是,我已将 IP 调整为 read .200,因为.888不是有效的 IP

    options {
            directory "/var/cache/bind";

            // If there is a firewall between you and nameservers you want
            // to talk to, you may need to fix the firewall to allow multiple
            // ports to talk.  See http://www.kb.cert.org/vuls/id/800113

            // If your ISP provided one or more IP addresses for stable 
            // nameservers, you probably want to use them as forwarders.  
            // Uncomment the following block, and insert the addresses replacing 
            // the all-0's placeholder.

            // forwarders {
            //      0.0.0.0;
            // };

            //========================================================================
            // If BIND logs error messages about the root key being expired,
            // you will need to update your keys.  See https://www.isc.org/bind-keys
            //========================================================================
            recursion yes;
            allow-recursion {localnets; 192.168.1.0/16;};

            forwarders {
                    192.168.1.1;
            };

            dnssec-enable yes;
            dnssec-validation auto;
            dnssec-lookaside auto;

            auth-nxdomain no;    # conform to RFC1035
            listen-on { 192.168.1.200; 127.0.0.1; };
            // listen-on-ipv6 { any; };
    };
Run Code Online (Sandbox Code Playgroud)

仔细检查设置后,重新启动bind并查找日志和输出以确定问题。请发布您找到的确切命令和日志,因为可能有更多错误,如果没有所有详细信息,任何人都很难提供帮助。

一个额外的提示是一次改变一件事。更改您的 IP,验证您仍然可以连接。然后,调整绑定等。采取迭代方法,并确保每次进行更改时,您都没有破坏其他一切。