
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";