[Dnsmasq-discuss] DNS TTL for responses based on DHCP leases

Lorin Weilenmann lorin.weilenmann at gmail.com
Thu Feb 11 07:54:45 GMT 2016


Hi list,

Currently, dnsmasq sets the DNS TTL for queries which it answers from local
sources to 0 (or the value of --local-ttl). While this may be okay for
entries out of /etc/hosts and addn-host files, it seems at least
questionable for DHCP leases.

IMHO, a good DNS TTL for a DHCP lease would be the remaining duration of
the lease (or half of that, since most DHCP clients renew their leases when
half the lease time expired). Because many DHCP clients don't send a
DHCPRELEASE when they disconnect from the network (either because they
can't in case of wifi, or because they just don't), the DHCP server usually
has no way invalidating a lease before it expires anyway.

I'd also love to have an option to set a DNS TTL per host-file entry, i.e.
with a format like this:
1.2.3.4 host.domain.tld #3600
which would mean if the host line is followed by a comment which is a
number, use that number in seconds as TTL for DNS responses.

The reason behind my request is the following: I have significant LAN
traffic based on DNS, which results in unnecessary load on dnsmasq as it
always responds with TTL 0 and thus prevents local caching. This also means
that the entire LAN immediately "dies" if I the dnsmasq box isn't available
even for a very short period (reboot). Setting --local-ttl is also not a
feasible in my case because I have a backup internet connection, and one of
my /etc/hosts entries points to the current external IP. This DNS response
should go out with TTL 0. This way, the LAN clients can receive the new
external IP immediately. By increasing --local-ttl, they'd get the "news"
only after local-ttl seconds.

Any thoughts on my suggestions?

Thanks,
Lorin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20160211/bfc6da89/attachment.html>


More information about the Dnsmasq-discuss mailing list