Debian

DNS 伺服器不工作

  • August 28, 2016

我想為學習目的執行 DNS 伺服器,但我不斷收到此錯誤消息。你能幫忙嗎?(virtualbox中的虛擬機:eth0 - NAT,eth1 - 內部適配器)

debianserver@debianserver:~$ sudo /etc/init.d/bind9 restart
[ ok ] Restarting bind9 (via systemctl): bind9.service.

debianserver@debianserver:~$ sudo tail /var/log/syslog
Aug 28 09:48:25 debianserver named[1787]: zone 0.in-addr.arpa/IN: loaded serial 1
Aug 28 09:48:25 debianserver named[1787]: dns_rdata_fromtext: /etc/bind/db.tanulas:17: near eol: unexpected end of input
Aug 28 09:48:25 debianserver named[1787]: zone tanulas.hu/IN: loading from master file /etc/bind/db.tanulas failed: unexpected end of input
Aug 28 09:48:25 debianserver named[1787]: zone tanulas.hu/IN: not loaded due to errors.
Aug 28 09:48:25 debianserver named[1787]: zone 2.0.192.in-addr.arpa/IN: loaded serial 2016101001
Aug 28 09:48:25 debianserver named[1787]: zone 255.in-addr.arpa/IN: loaded serial 1
Aug 28 09:48:25 debianserver named[1787]: zone 127.in-addr.arpa/IN: loaded serial 1
Aug 28 09:48:25 debianserver named[1787]: zone localhost/IN: loaded serial 2
Aug 28 09:48:25 debianserver named[1787]: all zones loaded
Aug 28 09:48:25 debianserver named[1787]: running

文件/etc/bind/db.tanulas

$TTL 86400
@ IN SOA debianserver.tanulas.hu. root.debianserver.tanulas.hu. (
       201610141       ;Serial
       28800   ;Refresh
       7200    ;Retry
       604800  ;Expire
       86400 ) ;Negativ cache TTL

@ IN NS debianserver.tanulas.hu.
debianserver    IN      A       192.0.2.5
@       IN      MX 10   debianserver.tanulas.hu.

ns      IN      CNAME   debianserver.tanulas.hu.
www     IN      CNAME   debianserver.tanulas.hu.
ftp     IN      CNAME   debianserver.tanulas.hu.
mail    IN      CNAME   debianserver.tanulas.hu.
ssh     IN      CNAME   debianserver.tanulas.hu.

debianserver    IN      HINFO   Linux/Jessie

win8    IN      A       192.0.2.3

已編輯文件列表(按照老師的指示):/etc/bind/named.conf.local, /etc/bind/db.tanulas, /etc/bind/db.2.0.192,/etc/resolv.conf

順便說一句/etc/resolv.conf,每次重新啟動後總是被我主機的機器名稱伺服器覆蓋。為什麼?它應該包含

search tanulas.hu 
nameserver 192.0.2.5

但事實並非如此。

# Generated by NetworkManager
nameserver 84.2.46.1
nameserver 84.2.44.1

這是對 DNS 伺服器的查詢。

debianserver@debianserver:~$ dig @localhost tanulas.hu

; <<>> DiG 9.9.5-9+deb8u6-Debian <<>> @localhost tanulas.hu
; (2 servers found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 35896
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;tanulas.hu.            IN  A

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Sun Aug 28 14:26:31 CEST 2016
;; MSG SIZE  rcvd: 39

nslookup對於 debianserver 以連接超時結束。

如果它很重要,則udhcpd可以正常工作。

謝謝

HINFO 必須有 2 個參數:“CPU/硬體”和“OS”。你只有一個。嘗試擴展它:

debianserver IN HINFO Linux/Jessie makosteszta

引用自:https://unix.stackexchange.com/questions/306211