Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.