Discussion:
[Dnsmasq-discuss] Disable caching for some hostname
Fabio Venturi
2016-03-31 09:23:08 UTC
Permalink
Hello to anyone,
I've setup dnsmasq on several machine, mostly to avoid the limitation of 3
NS in resolv.conf ,
as a bonus now I have a nice caching for name resolution (no DHCP needed).
The problem arise with a single hostname (a CNAME really) that is updated
automatically
under certain circumstances.

Is there a way to disable caching only for some names?

I've found a workaround, but i don't know if it's a bug:
if I put in /etc/hosts all the real hostname to which the CNAME could refer
to (but NOT the CNAME itself),
the CNAME is never cached and all requests for that CNAME are always sent
to the upstream DNS.

For example, in /etc/hosts:
srv1.mynet.lan 1.1.1.1
srv2.mynet.lan 2.2.2.2
srv3.mynet.lan 3.3.3.3

(logging the queries sent to dnsmasq, i can see the following request is
always forwarded)
# host service.mynet.lan
service.mynet.lan is an alias for srv2.mynet.lan.
srv2.mynet.lan has address 2.2.2.2

I hope i've explained clearly the problem,
thank you in advance for any hint.

My kindest regards,
Fabio
Simon Kelley
2016-04-04 16:20:14 UTC
Permalink
If the CNAME is updated automatically, it should have a very short (or
even zero) time-to-live in the upstream nameserver. Dnsmasq will
honour such a TTL value.

Cheers,

Simon.
Hello to anyone, I've setup dnsmasq on several machine, mostly to
avoid the limitation of 3 NS in resolv.conf , as a bonus now I have
a nice caching for name resolution (no DHCP needed). The problem
arise with a single hostname (a CNAME really) that is updated
automatically under certain circumstances.
Is there a way to disable caching only for some names?
I've found a workaround, but i don't know if it's a bug: if I put
in /etc/hosts all the real hostname to which the CNAME could refer
to (but NOT the CNAME itself), the CNAME is never cached and all
requests for that CNAME are always sent to the upstream DNS.
For example, in /etc/hosts: srv1.mynet.lan 1.1.1.1 srv2.mynet.lan
2.2.2.2 srv3.mynet.lan 3.3.3.3
(logging the queries sent to dnsmasq, i can see the following
request is always forwarded) # host service.mynet.lan
service.mynet.lan is an alias for srv2.mynet.lan. srv2.mynet.lan
has address 2.2.2.2
I hope i've explained clearly the problem, thank you in advance for
any hint.
My kindest regards, Fabio
_______________________________________________ Dnsmasq-discuss
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
Loading...