[dnsdist] Disable cache for certain sources
Andreas Wili
cicco0 at outlook.com
Tue Apr 16 19:28:09 UTC 2024
Hi,
On 16.04.24 19:09, Jacob Bunk Nielsen via dnsdist wrote:
> Hi
>
> Andreas Wili via dnsdist <dnsdist at mailman.powerdns.com> writes:
>
>> I have dnsdist deployed centrally to route DNS queries to various backends:
>> [...]
>> In this setup, I use caching as follows:
>> cache_all_queries = newPacketCache(2000000, {maxTTL=86400, minTTL=0,
>> temporaryFailureTTL=60, staleTTL=60})
>> getPool(""):setCache(cache_all_queries)
>>
>> I would now need to disable caching for certain servers that issue a DNS query. Is there a
>> rule for this or any other option?
>
> Do you mean that you do not want to cache responses from e.g.
> "backend2"? Then you can try something like:
>
> -- Configure backends in separate pools
> newServer({
> address='192.168.100.10',
> name='backend1',
> pool='use_cache_pool'
> })
> newServer({
> address='192.168.100.20',
> name='backend2',
> pool='no_cache_pool'
> })
>
> -- Create cache
> cache_all_queries = newPacketCache(2000000,
> {maxTTL=86400,
> minTTL=0,
> temporaryFailureTTL=60,
> staleTTL=60})
> -- Set cache for the "use_cache_pool"
> getPool('use_cache_pool'):setCache(cache_all_queries)
>
> -- route requests to your two pools, this will route ~50% to the pool
> -- using cache and the remaining queries to your no_cache_pool.
> -- You probably want something else, but I can't guess what.
> AddAction(ProbaRule(0.5), PoolAction('use_cache_pool'))
> AddAction(AllRule(), PoolAction('no_cache_pool'))
>
> If it's something else you wish to achieve, then please describe in more
> words, e.g. with an example.
>
> Best regards,
> Jacob
> _______________________________________________
> dnsdist mailing list
> dnsdist at mailman.powerdns.com
> https://mailman.powerdns.com/mailman/listinfo/dnsdist
dnsdist has been installed on the server with the IP address
192.168.100.4 and configured with the specified configuration.
All other servers in the network have been configured to use this server
as their resolver in /etc/resolv.conf:
# /etc/resolv.conf
nameserver 192.168.100.4
In general, DNS resolution via dnsdist works based on the configured
backends.
Now, there are two servers on the network for which all DNS queries must
not be cached.
The question is whether a rule can be defined to exclude queries from
these two servers based on their IP addresses from being cached. If
caching cannot be disabled for specific source IP addresses using a
rule, then the only option is to define another backend where caching is
not active, right?
I hope I was able to describe the issue more clearly now.
Best regards,
Andreas
More information about the dnsdist
mailing list