NS 记录配置在 ubuntu 上的 bind(bind9)中不起作用

NS 记录配置在 ubuntu 上的 bind(bind9)中不起作用

我有以下区域文件:

testzone.local. IN SOA MyUbuntu hostname (
                          6        ; Serial
                          3h       ; Refresh after 3 hours
                          1h       ; Retry after 1 hour
                          1w       ; Expire after 1 week
                          1h )     ; Negative caching TTL of 1 hour


;----------------  records --------------

b._dns-sd._udp          IN      PTR     device-discovery
lb._dns-sd._udp         IN      PTR     device-discovery
device-discovery        IN      NS      test-server-host
test-server-host        IN      A       192.168.1.10

;--------------- End of records --------- 


;
; Name servers

;
@ IN NS MyUbuntu
MyUbuntu IN      A       192.168.1.28
devicemachine  IN  A     192.168.1.10

Dig 给出了 和 的答案b._dns-sd._udp.testzone.locallb._dns-sd._upd.testzone.localtest-server-host没有给出以下是我对NSdevice-discovery.testzone.local.进行挖掘的结果device-discovery.testzone.local

kg@MyUbuntu:~$ dig @localhost NS device-discovery.testzone.local

; <<>> DiG 9.10.3-P4-Ubuntu <<>> @localhost NS device-discovery.testzone.local
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 13783
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;device-discovery.testzone.local. IN    NS

;; Query time: 3 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Fri Feb 17 07:35:27 AEDT 2017
;; MSG SIZE  rcvd: 64

区域文件有什么问题吗?我在网上看到了很多例子,我以为它能正常工作。

多谢。

更新了区域文件,但仍然无法正常工作

kg@MyUbuntu:/etc/bind/zones$ cat db.testzone.local 
testzone.local. IN SOA MyUbuntu hostname (
                          9        ; Serial
                          3h       ; Refresh after 3 hours
                          1h       ; Retry after 1 hour
                          1w       ; Expire after 1 week
                          1h )     ; Negative caching TTL of 1 hour

testzone.local. IN NS MyUbuntu.testzone.local.
testzone.local. IN NS hostname.testzone.local.


b._dns-sd._udp          IN  PTR     device-discovery
lb._dns-sd._udp         IN  PTR     device-discovery
device-discovery    IN  NS      test-server-host
test-server-host    IN  A       192.168.1.10


;
; Name servers

;
@ IN NS MyUbuntu
MyUbuntu    IN  A   192.168.1.28
hostname IN A 192.168.1.28

kg@ MyUbuntu:/etc/bind/zones$ named-checkzone testzone.local db.testzone.local 
db.testzone.local:1: no TTL specified; using SOA MINTTL instead
zone testzone.local/IN: loaded serial 9
OK
kg@ MyUbuntu:/etc/bind/zones$ sudo service bind9 restart
kg@ MyUbuntu:/etc/bind/zones$ sudo service bind9 status
● bind9.service - BIND Domain Name Server
   Loaded: loaded (/lib/systemd/system/bind9.service; enabled; vendor preset: enabl
   Active: active (running) since Fri 2017-02-17 11:55:59 AEDT; 5s ago
     Docs: man:named(8)
  Process: 5402 ExecStop=/usr/sbin/rndc stop (code=exited, status=0/SUCCESS)
 Main PID: 5407 (named)
    Tasks: 5 (limit: 9830)
   CGroup: /system.slice/bind9.service
           └─5407 /usr/sbin/named -f -u bind

Feb 17 11:55:59 MyUbuntu named[5407]: managed-keys-zone: loaded serial 41
Feb 17 11:55:59 MyUbuntu named[5407]: zone 0.in-addr.arpa/IN: loaded serial 
Feb 17 11:56:00 MyUbuntu named[5407]: /etc/bind/zones/db.testzone.local:1: n
Feb 17 11:56:00 MyUbuntu named[5407]: zone testzone.local/IN: loaded serial 
Feb 17 11:56:00 MyUbuntu named[5407]: zone localhost/IN: loaded serial 2
Feb 17 11:56:00 MyUbuntu named[5407]: zone 127.in-addr.arpa/IN: loaded seria
Feb 17 11:56:00 MyUbuntu named[5407]: zone 255.in-addr.arpa/IN: loaded seria
Feb 17 11:56:00 MyUbuntu named[5407]: all zones loaded
Feb 17 11:56:00 MyUbuntu named[5407]: running
Feb 17 11:56:00 MyUbuntu named[5407]: zone testzone.local/IN: sending notifi
kg@ MyUbuntu:/etc/bind/zones$ dig @localhost device-discovery.testzone.local. NS

; <<>> DiG 9.10.3-P4-Ubuntu <<>> @localhost device-discovery.testzone.local. NS
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 52820
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;device-discovery.testzone.local. IN    NS

;; Query time: 15 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Fri Feb 17 11:57:02 AEDT 2017
;; MSG SIZE  rcvd: 64

答案1

通过为子区域设置区域文件解决了这个问题。

我需要为子区域创建一个区域文件:device-discovery.testzone.local,并将区域信息添加到named.conf.local

在子区域的区域文件中,我将 device-discovery.testzone.local 的名称服务器定义为 test-server-host.testzone.local。成功了!

答案2

您的参数似乎dig不正确。要查询 DNS 记录类型,请在类型前指定域名 -- 使用dig @nameserver some.domain. type。对于您的示例,请尝试dig @localhost device-discovery.testzone.local. NS

相关内容