[dnsdist] Enabling cache for certain sources?

Fredrik Pettai pettai at sunet.se
Sun Apr 21 19:36:22 UTC 2024



> On 20 Apr 2024, at 19:59, Jacob Bunk Nielsen via dnsdist <dnsdist at mailman.powerdns.com> wrote:
> 
> Fredrik Pettai via dnsdist <dnsdist at mailman.powerdns.com> writes:
> 
>>> addAction(NetmaskGroupRule(no_cache_ips, true), SetSkipCacheAction())
>> 
>> Slightly OT, I wonder if it would be possible to reverse the suggested solution,
>> to cache only queries from specific IPs and skip the caching "for the rest” ?
> 
> You can just do something like this:
> 
> cache_ips = newNMG()
> 
> -- IPs of clients that should use the cache
> cache_ips:addMask('192.0.2.1/32')
> cache_ips:addMask('192.0.2.8/32')
> 
> addAction(NotRule(NetmaskGroupRule(cache_ips, true)), SetSkipCacheAction())

Ah, a reversing selector, I didn’t know that it existed.
Thanks for the pointer!

Re,
/P
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <http://mailman.powerdns.com/pipermail/dnsdist/attachments/20240421/31ab5c28/attachment.sig>


More information about the dnsdist mailing list