我在我的 Ubuntu 16.04 机器上安装了 bind9。
但我在解析本地域名时遇到了问题。像 google.com 这样的外部域名可以正常工作。
这是我的配置文件和我所做的故障排除。
向前:
$TTL 2D
@ IN SOA ns.mancina.home. root.mancina.home. (
22 ; Serial
8H ; Refresh
2H ; Retry
4W ; Expire
3H )
@ IN NS ns.mancina.home.
IN A 192.168.1.150
ns IN A 192.168.1.150
lenny IN A 192.168.1.150
homer IN A 192.168.1.110
撤销:
$TTL 2D
@ IN SOA ns.mancina.home. root.mancina.home. (
2 ; Serial
8H ; Refresh
2H ; Retry
4W ; Expire
3H )
@ IN NS ns.mancina.home.
150 IN PTR lenny.mancina.home.
110 IN PTR homer.mancina.home.
命名的.conf.本地
root@lenny:/etc/bind# cat 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";
logging {
channel query.log {
file "/var/log/query.log";
severity info;
print-time yes;
print-severity yes;
print-category yes;
};
category queries { query.log; };
};
命名的.本地.conf
zone "mancina.home" {
type master;
file "/etc/bind/db.mancina.home";
};
zone "1.168.192.in-addr.arpa" {
type master;
file "/etc/bind/db.1.168.192";
};
命名的.conf.选项
root@lenny:/etc/bind# cat named.conf.options
options {
directory "/var/cache/bind";
forwarders {
8.8.8.8 ;
};
dnssec-validation auto;
auth-nxdomain no; # conform to RFC1035
listen-on-v6 { any; };
};
测试
root@lenny:/etc/bind# named-checkzone db.mancina.home ./db.mancina.home
zone db.mancina.home/IN: loaded serial 22
OK
dig lenny.mancina.home
; <<>> DiG 9.10.3-P4-Ubuntu <<>> lenny.mancina.home
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 17304
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;lenny.mancina.home. IN A
;; AUTHORITY SECTION:
. 10610 IN SOA a.root-servers.net. nstld.verisign-grs.com. 2017071400 1800 900 604800 86400
;; Query time: 0 msec
;; SERVER: 192.168.1.150#53(192.168.1.150)
;; WHEN: Fri Jul 14 18:01:46 CEST 2017
;; MSG SIZE rcvd: 122
nslookup lenny.mancina.home
Server: 192.168.1.150
Address: 192.168.1.150#53
** server can't find lenny.mancina.home: NXDOMAIN
root@lenny:~# nslookup google.com
Server: 192.168.1.150
Address: 192.168.1.150#53
Non-authoritative answer:
Name: google.com
Address: 216.58.205.142
我希望任何人都能发现会议中的错误或者给我一些建议可能出了什么问题。
蒂娅·马蒂亚
答案1
named.local.conf 未包含在 named.conf 中
将此行添加到named.conf
:
include "/etc/bind/named.local.conf";