
我正在嘗試使用 bind9 建立 DNS 伺服器,但是當我嘗試使用 nslookup 或嘗試解析名稱時,它會給我一個 servfail 錯誤。
這是設定檔:
// 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";
smx@smx:~$ cat /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";
zone "thiefhunter.local"{
type master;
file "/etc/bind/zones/db.thiefhunter.local";
};
zone "1.168.192.in-addr.arpa"{
type master;
file "/etc/bind/zones/db.192.168.1";
};
這是我的反向區域配置:
;
; BIND data file for local loopback interface
;
$TTL 604800
@ IN SOA ns1.thiefhunter.local root.thiefhunter.local. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
IN NS ns1.thiefhunter.local.
ns1 IN A 192.168.1.37
server IN CNAME ns1.thiefhunter.local.
pc01 IN A 192.168.1.36
gw IN A 192.168.1.1
我要說的一件事是:我不知道 192.168.1.36 中的 pc01 是什麼意思,我的網絡中沒有具有此 ip 的 PC,但是我按照教程操作,結果出現了,我很抱歉建議。
這是我的反向區域配置:
;
; BIND reverse data file for local loopback interface
;
$TTL 604800
@ IN SOA ns1.thiefhunter.local root.thiefhunter.local. (
1 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS ns1.thiefhunter.local.
10 IN PTR ns1.thiefhunter.local.
1 IN PTR gw.thiefhunter.local.
我沒有編輯 /etc/bind/named.conf 因為我認為不需要它,
另外,當我嘗試對客戶端使用 nslookup 時,出現以下錯誤(客戶端已配置為使用我的 bin9 伺服器 IP 作為 DNS):
paco@paco-virtualbox:~$ nslookup
> thiefhunter.local
Server: 127.0.0.53
Address: 127.0.0.53#53
** server can't find thiefhunter.local: SERVFAIL
> 192.168.1.37
** server can't find 37.1.168.192.in-addr.arpa: NXDOMAIN
> 192.168.1
Server: 127.0.0.53
Address: 127.0.0.53#53
** server can't find 192.168.1: NXDOMAIN
感謝您的寶貴時間並感謝您的閱讀
答案1
看起來你有點困惑和/或正在看一個糟糕的教學。
第一個區域檔案不適用於反向 DNS - 它是一個正向查找,它將以 thiefhunter.local 結尾的網域轉換為 IP 位址。
server 192.168.1.37
這是 tjat 進行反向查找的第二個區域檔案。您需要在其中新增適當的條目以將 IP 轉換為網域。
左側是 IP 位址的最後一位數字 - 在您的情況下為 37。
37 server.thiefhunter.local.
「pc01 IN A 192.168.1.36」是將 pc01.thiefhunter.local 轉換為 IP 位址 192.168.1.36 的條目 - 如果該 IP 上沒有機器,則可以將其刪除。