0

I have a situation where my hosts file is constantly changing. Because of this I don't want clients to cache ip addresses resolved using the hosts file. Here is the command that starts dnsmasq for me:

 /usr/sbin/dnsmasq -K -R -y -Z -b -E -S 8.8.8.8 -l /tmp/dhcp.leases -r /tmp/resolv.conf.auto --stop-dns-rebind --rebind-localhost-ok --dhcp-range=lan,192.168.2.2,192.168.2.249,255.255.255.0,12h -2 eth0

In looking at this site: http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html

I see that the -T option has this description:

 -T, --local-ttl=<time>
 When replying with information from /etc/hosts or the DHCP leases file
 dnsmasq by default sets the time-to-live field to zero, meaning that 
 the requester should not itself cache the information. This is the 
 correct thing to do in almost all situations. This option allows a 
 time-to-live (in seconds) to be given for these replies. This will 
 reduce the load on the server at the expense of clients using stale 
 data under some circumstances.

My command doesn't have the -T option. Do I need it or does dnsmasq default TTL to zero without it?

user548971
  • 259
  • 1
  • 3
  • 10

1 Answers1

1

Correct, if you omit the -T or --local-ttl flag, it simply defaults to zero (for requests from the local machine, like from your hosts file).

You can also set a --max-ttl flag to indicate the maximum TTL value passed back to clients for recursive requests.

Mathias R. Jessen
  • 25,161
  • 4
  • 63
  • 95
  • hmmm....then this should be working for me. There must be something else going on. Do some clients ignore the ttl and cache anyway? Or is there something else missing in my command? – user548971 Nov 29 '12 at 22:03