我怎样才能让 bind 返回与 DNSMASQ 返回的相同的 dns 答案?

我怎样才能让 bind 返回与 DNSMASQ 返回的相同的 dns 答案?

由于 Dnsmasq 不支持视图,我已安装并配置了 bind9。一切正常,但我注意到在特定条目上,我的绑定服务器没有返回与 Dnsmasq 相同的答案/响应。我该如何实现这一点?

这是我的 Dnsmasq 服务器的配置:

address=/override-url.example.com/54.210.175.6

这是来自我的 Dnsmaq 服务器的 DNS 响应:

$ dig @127.0.0.1 override-url.example.com

回复:

; <<>> DiG 9.9.5-3-Ubuntu <<>> @127.0.0.1 override-url.example.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 53532
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;override-url.example.com.  IN  A

;; ANSWER SECTION:
override-url.example.com. 0 IN  A   1.2.3.4

;; Query time: 1 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Wed Aug 06 21:58:44 UTC 2014
;; MSG SIZE  rcvd: 58

这是我的绑定配置和区域文件:

    zone "override-url.example.com" {
            type master;
            file "/etc/bind/override-url.example.com";
    };

区域文件:

$TTL    3600
$ORIGIN override-url.example.com.

@       IN SOA localhost. hostmaster.localhost.com. (
        20140805 ; sn = serial number
        86400    ; ref = refresh = 1d
        900      ; ret = update retry = 15m
        1209600  ; ex = expiry = 2w
        3600     ; min = minimum = 1h
        )

        ; we need at least 1 name server
        IN NS

        ; override public ip with this address
        IN A 54.210.127.53

当然,这是 bind 返回的数据,与上面的答案不匹配。我希望尽可能地匹配。

; <<>> DiG 9.8.3-P1 <<>> override-url.example.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 12930
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;override-url.example.com.  IN  A

;; Query time: 36 msec
;; SERVER: 54.88.72.140#53(54.88.72.140)
;; WHEN: Wed Aug  6 18:04:23 2014
;; MSG SIZE  rcvd: 42

我应该对绑定区域文件进行哪些更改以使其看起来尽可能接近 dnsmasq 设置?

答案1

想通了,必须做出以下改变:

添加minimal-responses yes;named.conf.options

并将区域文件更改为以下内容:

$TTL    3600
$ORIGIN override-url.example.com.

@       IN SOA override-url.example.com. hostmaster.override-url.example.com. (
        20140805 ; sn = serial number
        86400    ; ref = refresh = 1d
        900      ; ret = update retry = 15m
        1209600  ; ex = expiry = 2w
        3600     ; min = minimum = 1h
        )

        ; we need at least 1 name server
        IN NS override-url.example.com.

        ; override public ip with this address
        IN A 54.210.127.53

相关内容