我正在尝试在虚拟机上设置 openbalena,它需要 DNS 记录才能被发现。我已按如下方式设置 bind9:
/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 "local" {
type master;
file "/etc/bind/zones/db.local";
};
zone "0.168.192.in-addr.arpa" {
type master;
file "/etc/bind/zones/db.192.168.0";
};
/etc/bind/zones/db.local
@ IN SOA local. admin.local. (
5 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
IN NS openbalena.local.
openbalena.local. IN A 192.168.0.166
api.openbalena.local. IN CNAME openbalena.local.
registry.openbalena.local. IN CNAME openbalena.local.
vpn.openbalena.local. IN CNAME openbalena.local.
s3.openbalena.local. IN CNAME openbalena.local.
还有相应的反向查找区域。由于 DNS 服务器与 openbalena 在同一台服务器上运行,因此地址相同。
我可以像这样访问记录:
$ nslookup openbalena.local 192.168.0.166
Server: 192.168.0.166
Address: 192.168.0.166#53
Name: openbalena.local
Address: 192.168.0.166
但是,如果我省略 DNS 地址,就会出现此错误
$ nslookup openbalena.local
Server: 127.0.0.53
Address: 127.0.0.53#53
** server can't find openbalena.local: SERVFAIL
我的/etc/resolv.conf
样子
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.
nameserver 127.0.0.53
并向systemd-resolve --status
我提供以下信息(节选):
Global
DNS Servers: 192.168.0.166
192.168.0.1
DNSSEC NTA: 10.in-addr.arpa
16.172.in-addr.arpa
168.192.in-addr.arpa
17.172.in-addr.arpa
[...]
Link 3 (wlp1s0)
Current Scopes: DNS
LLMNR setting: yes
MulticastDNS setting: no
DNSSEC setting: no
DNSSEC supported: no
DNS Servers: 192.168.0.166
192.168.0.1
[...]
本地 DNS 服务器似乎位于列表顶部,所以我不确定为什么它不起作用。当然,我可以将相关名称添加到/etc/hosts
,但我需要它为网络上的另一台设备工作,而这不是一个选项。任何帮助都将不胜感激!