2

I have a caching recursive DNS server running bind9. For a single local zone, I have a forwarder set up with type forward and forward only, which works fine. I want to limit any caching of the forwarded zone to 5 seconds (both positive and negative responses). The server I am forwarding to is local, cannot be fiddled with, and sadly has less than helpful values for cache TTL etc. for records it generates dynamically (in essence it's making an assumption that it is the caching resolver for everything).

I would use max-cache-ttl and max-ncache-ttl save that as far as I can tell max-cache-ttl and max-ncache-ttl only apply globally, or to a view.

Here's my configuration:

zone "example.local." {
     type forward;
     forward only;
     // max-cache-ttl 5;   <--- does not work here
     // max-ncache-ttl 5;  <--- does not work here
     forwarders {
          192.200.1.10;   // on same LAN
     };
};

Ideally I don't want to turn caching off entirely but that would be an option if it's the only thing I can do.

Any ideas?

0

I don't believe there's an easy way of doing it through configuration only. This question on Server Fault discusses the pros and cons and has a suggestion that involves patching the BIND source (but that patch won't allow you to do it for a single zone only).

An alternative approach would be to transfer the zone from the server you're forwarding to, modify the TTLs and then have your local BIND configured as authoritative for that zone. Yes, it's a hack but it's easily scriptable and it will work.

If you're not tied to BIND, what you want is possible with Unbound - see the cache-max-ttl option:

Time to live maximum for RRsets and messages in the cache. Default is 86400 seconds (1 day). If the maximum kicks in, responses to clients still get decrementing TTLs based on the original (larger) values. When the internal TTL expires, the cache item has expired. Can be set lower to force the resolver to query for data often, and not trust (very large) TTL values.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.