绑定 DNS 配置未显示域的 A 记录

绑定 DNS 配置未显示域的 A 记录

我是 DNS 设置新手,并遵循了有关设置绑定 DNS 的几条说明。以下是我的区域文件:

;
$TTL    604800
@       IN      SOA     sandbox.svr. root.viper.sandbox.svr. (
                              13        ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;

; Name servers
@       IN      NS      sandbox.svr.
@       IN      A       192.168.1.7
; A records for name servers

viper.sandbox.svr   IN  A       192.168.1.7
viper           IN      A       192.168.1.7


;
; BIND reverse data file for local loopback interface
;
$TTL    604800
@       IN      SOA    viper.sandbox.svr. root.sandbox.svr. (
                              11        ;Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;

; name servers - NS Records

@       IN      NS      viper.sandbox.svr.

; PTR Records
10      IN      PTR     viper.sandbox.svr.

当我跑步时

dig sandbox.svr 

它没有返回任何 A 记录。

但当我测试时:

  dig viper.sandbox.svr

它确实返回了 A 记录:

root@viper:/var/log# dig viper.sandbox.svr

; <<>> DiG 9.16.1-Ubuntu <<>> viper.sandbox.svr
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 489
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;viper.sandbox.svr.     IN  A

;; ANSWER SECTION:
viper.sandbox.svr.  0   IN  A   192.168.1.7

;; Query time: 0 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Fri Oct 16 20:16:56 WAT 2020
;; MSG SIZE  rcvd: 62

我可能做错了什么?我的配置适用于本地环境并在 Ubuntu 20.04 桌面上运行。

请参阅下面的系统日志输出。

  
Oct 18 08:52:59 viper named[312379]: using default UDP/IPv4 port range: [32768, 60999]
Oct 18 08:52:59 viper named[312379]: using default UDP/IPv6 port range: [32768, 60999]
Oct 18 08:52:59 viper named[312379]: listening on IPv4 interface lo, 127.0.0.1#53
Oct 18 08:52:59 viper named[312379]: listening on IPv4 interface enp0s31f6, 192.168.1.7#53
Oct 18 08:52:59 viper named[312379]: listening on IPv4 interface virbr0, 192.168.122.1#53
Oct 18 08:52:59 viper named[312379]: listening on IPv4 interface br-048207a4c5eb, 172.19.0.1#53
Oct 18 08:52:59 viper named[312379]: listening on IPv4 interface br-22b8ad392785, 172.23.0.1#53
Oct 18 08:52:59 viper named[312379]: listening on IPv4 interface br-48aff5a17a13, 172.18.0.1#53
Oct 18 08:52:59 viper named[312379]: listening on IPv4 interface br-7ce2fd66ca47, 172.21.0.1#53
Oct 18 08:52:59 viper named[312379]: listening on IPv4 interface br-c5039c7c4806, 172.20.0.1#53
Oct 18 08:52:59 viper named[312379]: listening on IPv4 interface docker0, 172.17.0.1#53
Oct 18 08:52:59 viper named[312379]: listening on IPv4 interface br-c89505e1a15e, 172.22.0.1#53
Oct 18 08:52:59 viper named[312379]: unable to set effective uid to 0: Operation not permitted
Oct 18 08:52:59 viper named[312379]: generating session key for dynamic DNS
Oct 18 08:52:59 viper named[312379]: unable to set effective uid to 0: Operation not permitted
Oct 18 08:52:59 viper named[312379]: sizing zone task pool based on 7 zones
Oct 18 08:52:59 viper named[312379]: none:100: 'max-cache-size 90%' - setting to 14184MB (out of 15760MB)
Oct 18 08:52:59 viper named[312379]: obtaining root key for view _default from '/etc/bind/bind.keys'
Oct 18 08:52:59 viper named[312379]: set up managed keys zone for view _default, file 'managed-keys.bind'
Oct 18 08:52:59 viper named[312379]: none:100: 'max-cache-size 90%' - setting to 14184MB (out of 15760MB)
Oct 18 08:52:59 viper named[312379]: configuring command channel from '/etc/bind/rndc.key'
Oct 18 08:52:59 viper named[312379]: command channel listening on 127.0.0.1#953
Oct 18 08:52:59 viper named[312379]: configuring command channel from '/etc/bind/rndc.key'
Oct 18 08:52:59 viper named[312379]: couldn't add command channel ::1#953: address not available
Oct 18 08:52:59 viper named[312379]: managed-keys-zone: loaded serial 40
Oct 18 08:52:59 viper named[312379]: zone 1.168.192.in-addr.arpa/IN: loaded serial 11
Oct 18 08:52:59 viper named[312379]: zone 127.in-addr.arpa/IN: loaded serial 1
Oct 18 08:52:59 viper named[312379]: zone 0.in-addr.arpa/IN: loaded serial 1
Oct 18 08:52:59 viper named[312379]: zone 255.in-addr.arpa/IN: loaded serial 1
Oct 18 08:52:59 viper named[312379]: zone localhost/IN: loaded serial 2
Oct 18 08:52:59 viper named[312379]: zone sandbox.svr/IN: loaded serial 197
Oct 18 08:52:59 viper named[312379]: all zones loaded
Oct 18 08:52:59 viper named[312379]: running
Oct 18 08:52:59 viper named[312379]: zone sandbox.svr/IN: sending notifies (serial 197)
Oct 18 08:52:59 viper named[312379]: address not available resolving './NS/IN': 2001:500:200::b#53
Oct 18 08:52:59 viper named[312379]: address not available resolving './NS/IN': 2001:500:1::53#53
Oct 18 08:52:59 viper named[312379]: address not available resolving './NS/IN': 2001:500:2::c#53
Oct 18 08:52:59 viper named[312379]: address not available resolving './NS/IN': 2001:503:c27::2:30#53
Oct 18 08:52:59 viper named[312379]: address not available resolving './NS/IN': 2001:500:2d::d#53
Oct 18 08:52:59 viper named[312379]: address not available resolving './NS/IN': 2001:500:12::d0d#53
Oct 18 08:52:59 viper named[312379]: address not available resolving './NS/IN': 2001:503:ba3e::2:30#53
Oct 18 08:52:59 viper named[312379]: address not available resolving './NS/IN': 2001:500:2f::f#53
Oct 18 08:52:59 viper named[312379]: address not available resolving './NS/IN': 2001:500:9f::42#53
Oct 18 08:52:59 viper named[312379]: address not available resolving './NS/IN': 2001:7fe::53#53
Oct 18 08:52:59 viper named[312379]: address not available resolving './NS/IN': 2001:500:a8::e#53
Oct 18 08:52:59 viper named[312379]: address not available resolving './NS/IN': 2001:7fd::1#53
Oct 18 08:52:59 viper named[312379]: address not available resolving './NS/IN': 2001:dc3::35#53
Oct 18 08:53:00 viper named[312379]: managed-keys-zone: Key 20326 for zone . is now trusted (acceptance timer complete)
Oct 18 08:53:00 viper named[312379]: resolver priming q 

我尝试通过断开互联网连接来排除故障,并注意到 dig 响应了 A 记录,但一旦连接到互联网,它就不会响应。有没有办法让当地的DNS 解析本地查询并将公共名称转发给 google dns 服务器?

答案1

请加:

@ 在 192.168.1.7

然后它将回答纯域查询,不带主机名。

谢谢,

相关内容