[Dnsmasq-discuss] Caching with custom upstream domain

Petr Menšík pemensik at redhat.com
Thu Jul 13 14:27:37 BST 2017


Hello Paulo,

I did a quick test but it seems it does cache the responses.

It would help if you could show us dig query result

$ dig -p 8600 @127.0.0.1 consul.service.consul

It depends on what TTL is used for replies from Consul server. If TTL in
second column is 0, it should not be cached by dnsmasq. You would have
to change consul service in that case.

Or use min-cache-ttl=120 or higher value. But that TTL might have good
reason, it would be better to fix the service.

Dne 12.7.2017 v 16:20 Paulo Bittencourt napsal(a):
> Hello!
> 
> We are using dnsmasq for local DNS caching on all our hosts.
> 
> We've set up a custom upstream domain to route DNS requests for Consul
> to the local Consul agent, using this config directive:
> 
> server=/consul/127.0.0.1#8600 <http://127.0.0.1#8600>
> 
> Looking at the load the Consul agent, we were suspecting that dnsmasq
> was not caching the replies from Consul.  After enabling query logging
> on dnsmasq, it looks like this is the case.
> 
> If I query any other domain repeatedly, (eg. example.com
> <http://example.com>, google.com <http://google.com>), it logs that it's
> using the cache:
> 
> Jul 12 13:56:56 ip-10-184-50-103 dnsmasq[18119]: query[A] www.google.ca
> <http://www.google.ca> from 127.0.0.1
> Jul 12 13:56:56 ip-10-184-50-103 dnsmasq[18119]: cached www.google.ca
> <http://www.google.ca> is 172.217.5.227
> ... repeats ...
> 
> If I query a Consul domain repeatedly, it doesn't seem to use the cache:
> 
> Jul 12 13:57:55 ip-10-184-50-103 dnsmasq[18119]: query[A]
> consul.service.consul from 127.0.0.1
> Jul 12 13:57:55 ip-10-184-50-103 dnsmasq[18119]: forwarded
> consul.service.consul to 127.0.0.1
> Jul 12 13:57:55 ip-10-184-50-103 dnsmasq[18119]: reply
> consul.service.consul is 10.144.40.2
> Jul 12 13:57:55 ip-10-184-50-103 dnsmasq[18119]: reply
> consul.service.consul is 10.51.148.85
> Jul 12 13:57:55 ip-10-184-50-103 dnsmasq[18119]: reply
> consul.service.consul is 10.37.226.205
> ... repeats ...
> 
> I've searched for any documentation regarding caching behavior for
> custom upstream domains and I haven't found anything.
> 
> Any ideas?
> 
> Thanks,
> Paulo
> 
> 
> _______________________________________________
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss at lists.thekelleys.org.uk
> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
> 

-- 
--
Petr Menšík
Software Engineer
Red Hat, http://www.redhat.com/
email: pemensik at redhat.com  PGP: 65C6C973



More information about the Dnsmasq-discuss mailing list