运行 Ubuntu 18.04 LTS,我正在尝试将 Bind 配置为我的家庭实验室的 DNS 服务器,因为某些软件(VMware)需要 DNS 才能运行。
我遇到了反向查找无法正常工作的问题,而正向查找却返回 0 个答案。nslookup 也无法找到域,而且如果我在“/etc/resolv.conf”中将此服务器更改为使用其自身进行 DNS,它就没有网络连接。
我的绑定配置的内容是
命名配置文件
include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.local";
include "/etc/bind/named.conf.default-zones";
命名的.conf.选项
acl "trusted" {
10.0.1.90;
10.0.1.55;
10.0.1.57;
10.0.1.58;
10.0.1.100;
};
options {
directory "/var/cache/bind";
recursion yes; # enables resursive queries
allow-recursion { trusted; }; # allows recursive queries from "trusted" clients
listen-on { 10.0.1.90; }; # ns1 private IP address - listen on private network only
allow-transfer { none; }; # disable zone transfers by default
forwarders {
10.0.1.1;
8.8.8.8;
8.8.8.4;
};
dnssec-validation no;
auth-nxdomain no; # conform to RFC1035
listen-on-v6 { any; };
};
命名的.conf.本地
zone "myhome.lan" {
type master;
file "/etc/bind/for.myhome.lan";
};
zone "1.0.10.in-addr.arpa" {
type master;
file "/etc/bind/rev.myhome.lan";
};
我的家
$TTL 86400
@ IN SOA dns-01.myhome.lan. admin.myhome.lan. (
2018052102 ;Serial
3600 ;Refresh
1800 ;Retry
604800 ;Expire
86400 ;Minimum TTL
)
; Name Servers - NS records
@ IN NS dns-01.myhome.lan.
; Name Servers - A Records
dns-01 IN A 10.0.1.90
; VMware
vcsa-01 IN A 10.0.1.100
esxi-01 IN A 10.0.1.55
esxi-02 IN A 10.0.1.57
esxi-03 IN A 10.0.1.58
rev.myhome.lan
$TTL 86400
@ IN SOA myhome.lan. admin.myhome.lan. (
2018052101 ;Serial
3600 ;Refresh
1800 ;Retry
604800 ;Expire
86400 ;Minimum TTL
)
; Name Servers - NS records
@ IN NS dns-01.myhome.lan.
; Name Servers - A Records
dns-01 IN A 10.0.1.90
; PTR Records
90 IN PTR dns-01.myhome.lan.
100 IN PTR vcsa-01.myhome.lan.
55 IN PTR esxi-01.myhome.lan.
57 IN PTR esxi-02.myhome.lan.
58 IN PTR esxi-03.myhome.lan.
检查一切看起来都很好
root@dns-01:/etc/bind# named-checkconf
root@dns-01:/etc/bind# named-checkzone myhome.lan for.myhome.lan
zone myhome.lan/IN: loaded serial 2018052102
OK
root@dns-01:/etc/bind# named-checkzone myhome.lan rev.myhome.lan
zone myhome.lan/IN: loaded serial 2018052101
OK
但 dig 和 nslookup 不起作用
root@dns-01:/etc/bind# dig -x 10.0.1.90
; <<>> DiG 9.11.3-1ubuntu1-Ubuntu <<>> -x 10.0.1.90
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 10718
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;90.1.0.10.in-addr.arpa. IN PTR
;; ANSWER SECTION:
90.1.0.10.in-addr.arpa. 0 IN PTR dns-01.
90.1.0.10.in-addr.arpa. 0 IN PTR dns-01.local.
;; Query time: 14 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Mon May 21 17:14:41 UTC 2018
;; MSG SIZE rcvd: 97
root@dns-01:/etc/bind# dig myhome.lan
; <<>> DiG 9.11.3-1ubuntu1-Ubuntu <<>> myhome.lan
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 51346
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;myhome.lan. IN A
;; Query time: 1 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Mon May 21 17:14:48 UTC 2018
;; MSG SIZE rcvd: 41
root@dns-01:/etc/bind# nslookup myhome.lan
Server: 127.0.0.53
Address: 127.0.0.53#53
** server can't find myhome.lan: NXDOMAIN
我正在绞尽脑汁,如果能得到任何能帮我找出问题所在的话我将非常感激!
答案1
感谢@LienhartWoitok,我删除了 ACL 并将此行添加到 for.myhome.lan
@ IN A 10.0.1.90
这是必需的,因为我只搜索 myhome.lan,而没有在任何地方指定。添加该选项允许我搜索域本身。
通过将 @10.0.1.90 添加到我的 dig 命令中,我强制搜索我的域。我现在为我的家庭实验室配备了一个功能齐全的 DNS 服务器!
谢谢@LienthartWoitok