TTLオーバーライドと外部DNSレコードの設定

TTLオーバーライドと外部DNSレコードの設定

以下のようにバインドされたバージョンがあります。

9.8.2rc1-RedHat-9.8.2-0.30.rc1.el6.1.2

test.example.comとInternal-test.example.cloud.comという2つのドメイン固有のフォワーダがあります。

"test.example.com"ドメインの特定のcnameを確認する必要があるローカルDNSクライアントまたはリゾルバーは、自分のローカルDNSサーバーで構成されたフォワーダーに渡され、その応答もキャッシュされます。すべてが大丈夫です。問題ありません。しかし、私の問題は、Fordwaredクエリの場合、外部DNSサーバーがTTL値60で応答することです。したがって、内部DNSサーバーは60秒間だけ応答をキャッシュします。内部DNSサーバーのTTLをオーバーライドする方法はありますか?特定のドメインについて。

/etc/named.confは次のようになります

options {
        directory "/var/named";
        allow-transfer{"none";};
        allow-query {localhost; any;};
        dump-file "/var/log/named_dump.db";
        max-cache-ttl 300;
};

zone "test.example.com" IN {
        type forward;
        forwarders {11.1.2.17; 11.1.3.59;};
        forward only;
};

zone "internal-test.example.cloud.com" IN {
        type forward;
        forwarders {11.1.2.17; 11.1.3.59;};
        forward only;
};

zone "domain.local" in {
    type master;
    file "domain.local";
};



[root@dchockal ~]# dig test.example.com
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.30.rc1.el6.1.2 <<>> test.example.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 31197
;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;test.example.com.   IN      A

;; ANSWER SECTION:
test.example.com. 60 IN      CNAME   internal-test.example.cloud.com.
internal-test.example.cloud.com. 60 IN A 121.1.2.22
internal-test.example.cloud.com. 60 IN A 121.1.2.23
internal-test.example.cloud.com. 60 IN A 121.1.4.24
internal-test.example.cloud.com. 60 IN A 121.1.4.25

;; Query time: 133 msec
;; SERVER: 11.4.152.28#53(11.4.152.28)
;; WHEN: Thu Dec 15 15:31:22 2016
;; MSG SIZE  rcvd: 175

答え1

BINDはこれを行うことができず、これは良い習慣ではありません。しかし、BIND 9.10.4にアップデートできますか?この場合prefetch- オプションを使用できます。これにより、TTLが期限切れになる直前にBINDが一般的に使用されるドメインのキャッシュされたデータを更新します(特定の地域では利用可能ですが、このBINDバージョンはまだRaspbianでは利用できないためテストできません)。このオプションの詳細についてはこちらをご覧ください。

https://serverfault.com/questions/536952/bind9-how-to-automatically-refresh-entry-after-entry-expires

例えば、

options {
  ...
  prefetch 2 9;
};

キャッシュ更新は現在キャッシュ内のすべてのドメインで強制的に行われ、TTLの最後の2秒以内に照会され、通常TTLが9秒を超えると実行されます。

注:更新する場合は、BIND 9.10.4が正しいことを確認してください。 - メカニズムはprefetch9.10に導入されましたが、9.10.4から修正された醜いバグがありました。

https://kb.isc.org/article/AA-01315/0/prefetch-performance-in-BIND-9.10.html

答え2

私はBINDにそのような機能があるとは思わない。私はTTL(cache-max-ttl)だけを減らすだけで増やすことはできません(cache-min-ttl私のBINDでは動作しないようですが、試してみて、あなたのバージョンで動作していることを確認できます)。しかし、私たちは自分自身の権威あるドメインを作成できます。これが完了したら、このドメインに外部ドメインのCNAMEレコードを作成できます。

test.mydomain.com CNAME test.example.com.

その後、クエリはtest.mydomain.comIPアドレスで解決され、test.example.com必要に応じてTTLを設定できます。

理論的には、BINDによってキャッシュされた領域を上書きしてローカル領域ファイルとして生成し、TTLを設定してBINDを再起動できますが、これはひどいハッキングです。

ソフトウェアには3600秒以下のオプションdnsmasqがあります。指示に警告があります。--min-cache-ttl=<time>time

--min-cache-ttl=<time>

Extend short TTL values to the time given when caching them. Note that
artificially extending TTL values is in general a bad idea, do not do it
unless you have a good reason, and understand what you are doing. Dnsmasq
limits the value of this option to one hour, unless recompiled.

あなたの質問は、あなたがしていることを知っているようです。 Unboundにもこの機能があります。

cache-min-ttl: <seconds>

Time to live minimum for RRsets and messages in the cache. Default is 0.
If the minimum kicks in, the data is cached for longer than the domain owner
intended, and thus less queries are made to look up the data. Zero makes sure the
data in the cache is as the domain owner intended, higher values, especially more
than an hour or so, can lead to trouble as the data in the cache does not match
up with the actual data any more.

BIND を Unbound または dnsmasq に置き換えるか、どちらかを BIND のフォワーダとして使用することもできます。

関連情報