Some idiotic companies (yes Philips, I’m talking about you) set a TTL of 10 sec on some of their CNAMEs with 2 CNAME levels… As Mikrotik respects the CNAME TTL if it is lower than the max TTL, it updates the cache every TTL (domain in CNAME, in CNAME in A 2x). As a result, adding these domain names as an address list entry results in spamming the DNS server.
I found in the documentation a way to set the max TTL (i.e. to allow for instance “update once a day even if its TTL is set to one week”) , but could not find anything to set the min TTL.
So is there a “hidden” way in RouterOS to set the minimum TTL for DNS cache entries (i.e. to be able to tell the cache “do not update the entry more than once a day, even if the TTL tells you to” for instance) ?
You might be able use a “static” DNS entry for it and have schedule script that updates using a [:resolve shortttl.example.com server=]
/ip dns static set [find name=shortttl.example.com] address=[:resolve shortttl.example.com server=8.8.8.8]
But if it’s doing SRV or other kinds of lookups, which is totally possible, then this won’t work. This trick only work for A records (e.g. name to IP).
Same situation. DNS caching stores EVERYTHING. What is the reason to store entries that have 30 seconds expiry time? It just uses CPU without profit for end users…
It’s just following the provided TTL by a returned record, which be typically low for CDN for to maintain freshness.
Whether caching these short duration records is technically “overall efficient” (CPU, memory, etc.) — I don’t know but maybe. But RouterOS is “correctly” respecting the TTL provided.
While there is the “cache-max-ttl” option, but that limits the maximum TTL for really long TTLs. But there is NOT a reciprocal for the minimum TTL to skip caching below, so that’s not an option.
But you can always use public/ISP resolver from clients directly & avoid Mikrotik DNS caching entirely.