如何正确设置BIND作为DNS缓存服务?

时间:2019-05-28 09:38:45

标签: networking dns bind

我已经在我的Debian Stretch虚拟机上安装了BIND9,这是我的虚拟网络实验室的一部分-我希望安装了BIND的计算机充当其他人的防火墙,nat,dns和dhcp(现在我在各处设置静态IP,为简单起见)。它具有一个用于与专用网络交互的接口(eth1)和另一个用于访问Internet的接口(eth0)。

Ping到特定IP地址工作正常,因此正确设置了nat部分。 问题是将BIND设置为缓存DNS服务。 BIND服务正在正常启动,但是我收到以下错误消息(从装有BIND的同一台计算机上的nslookup):

nslookup google.com
Server:         127.0.0.1
Address:        127.0.0.1#53

** server can't find google.com: SERVFAIL

/etc/bind/named.conf.options

options {
        directory "/var/cache/bind";
        dnssec-validation auto;
        listen-on port 53 {10.0.0.1; 127.0.0.1; };
        recursion yes;
        allow-query { 127.0.0.1; any; };
        allow-query-cache { 127.0.0.1; any;};
        allow-recursion { 127.0.0.1; any; };
        auth-nxdomain no;    # conform to RFC1035
    };

/etc/bind/named.conf.default-zones

// prime the server with knowledge of the root servers
zone "." {
        type hint;
        file "/etc/bind/db.root";
};

// be authoritative for the localhost forward and reverse zones, and for
// broadcast zones as per RFC 1912

zone "localhost" {
        type master;
        file "/etc/bind/db.local";
};

zone "127.in-addr.arpa" {
        type master;
        file "/etc/bind/db.127";
};

zone "0.in-addr.arpa" {
        type master;
        file "/etc/bind/db.0";
};

zone "255.in-addr.arpa" {
        type master;
        file "/etc/bind/db.255";
};

/etc/bind/db.local

;
; BIND data file for local loopback interface
;
$TTL    604800
@       IN      SOA     localhost. root.localhost. (
                              2         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      localhost.
@       IN      A       127.0.0.1
@       IN      AAAA    ::1

/etc/bind/db.127

;
; BIND reverse data file for local loopback interface
;
$TTL    604800
@       IN      SOA     localhost. root.localhost. (
                              1         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      localhost.
1.0.0   IN      PTR     localhost.

/etc/bind/named.conf

// This is the primary configuration file for the BIND DNS server named.
//
// Please read /usr/share/doc/bind9/README.Debian.gz for information on the
// structure of BIND configuration files in Debian, *BEFORE* you customize
// this configuration file.
//
// If you are just adding zones, please do that in /etc/bind/named.conf.local

include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.local";
include "/etc/bind/named.conf.default-zones";

/etc/bind/named.conf.local

// Do any local configuration here
//

// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";

由于我是网络方面的新手,因此请多加提示。谢谢

0 个答案:

没有答案