绑定DNS服务器

绑定DNS服务器

enter code here我正在设置我的主 DNS 服务器。反向查找似乎工作正常,正向查找似乎是问题所在。

这是我的配置文件。

/etc/default/bind9:

RESOLVCONF=no
OPTIONS="-u bind -4"

/etc/bind/named.conf.options:

acl "trusted" { 192.168.1.0; localhost; };
options {
    directory "/var/cache/bind";
    recursion yes;
    allow-recursion { trusted; };
    listen-on { 192.168.1.204; 127.0.0.1; };
    allow-transfer { none; };
    forwarders { 
        192.168.1.254;
    };
// listen-on-v6 { any; };
};

/etc/bind/named.conf.local:

zone "example.home.local" {
    type master;
    file "etc/bind/zones/db.example.home.local";
    };

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

/etc/bind/zones/db.example.home.local:

;
; BIND data file for local loopback interface
;
$TTL    604800
@   IN  SOA ubuntuserver.example.home.local. root.example.home.local. (
                 14     ; Serial
             604800     ; Refresh
              86400     ; Retry
            2419200     ; Expire
             604800 )   ; Negative Cache TTL
;
;name servers - NS records
@   IN  NS  ubuntuserver.example.home.local.

;name servers - A records
ubuntuserver    IN  A   192.168.1.204

;subnet - A records
ubuntuweb   IN  A   192.168.1.208

/etc/bind/zones/db.1.168.192:

;
; BIND reverse data file for local loopback interface
;
$TTL    604800
@   IN  SOA example.home.local. root.example.home.local. (
                 11     ; Serial
             604800     ; Refresh
              86400     ; Retry
            2419200     ; Expire
             604800 )   ; Negative Cache TTL
; name servers
@   IN  NS  UbuntuServer.

; PTR records
204 IN  PTR ubuntuserver.example.home.local.
208 IN  PTR ubuntuweb.example.home.local.

正如前面提到的,反向查找工作得很好。当我跑步时

sudo named-checkzone 1.168.192.in-addr.arpa /etc/bind/zones/db.1.168.192

结果没问题,而且当我nslookup从测试客户端执行操作时,它能够成功地将 IP 地址解析为名称。

然而,当我跑步时

sudo named-checkzone example.home.local /etc/bind/zones/db.example.home.local

它报告回来

loading from master file /etc/bind/zones/db.example.home.local failed: unknown class/type

答案1

您有一个拼写错误,/etc/bind/named.conf.local缺少/数据库路径的前导:

file "etc/bind/zones/db.example.home.local";

相关内容