I use DNS cache on v4.1 on RB1000 and it works pretty well most of the time.
Unfortunately it also caches negative responses and it gives them 24h TTL. This is bad in case of temporary problems of a DNS domain or a DNS server. The domain is then inaccessible until the negative response expires or DNS cache is manually flushed (this can be automated by scripts but then it defeats the purpose of caching…)
I’d opt for configurable TTL, but I can live with hardcoded value of 5 minutes.
Thanks for your answer, I was aware of that setting, but it alone is not enough. It limits TTL of ALL records. From what I see at the moment, the average TTL of DNS records is about 6 hours. If I set cache-max-ttl to 5 minutes, I’ll be almost defeating the purpose of caching. It will also increase DNS traffic. For good explanation please see RFC 2308, section 2.2.1, subsection “5 - Caching Negative Answers”. They say TTL should be the minimum read from SOA record, but global cache-negative-max-ttl is still compliant
Our DNS cache should add negative records, when SOA is received.
Are you sure that SOA is not equal to 5 minutes (SOA parameter is specified by the owner of the DNS name).
The first two got 24hr TTL, the last one got 5 mins TTL, which I presume is from Google’s SOA.
I have problems with the first two - they should have much shorter TTL because the site may have had intermittent connectivity problems, but thanks to long TTL they are not available until tomorrow…
if you have set any DNS domain in DHCP or otherwise, or just to be sure, append DOT at the end to test it reliably.
ping www.not-existing-site.not-existing-tld.
ping www.not-existing-site.com.
ping www.not-existing.google.com.
A workaround would be to write and schedule script that changes the ttl of negative cache records from >1m to 1m. This would only affect the negative cache records, nothing else.
But in general, an option for negative cache max ttl under /ip/dns would be preferrable. Was there a feature request submitted for this? Should we submit one?
Juniper do have a setting for negative caching TTL. Would be nice to have such a setting, because during DNS tests, without that, the only solution is to flush the cache each time we want to remove a negative cached entry