Dnsmasq config for time to keep dns result?

I dont seem to be able to use dnsmasq as a caching dns server for more than 5 min which I think is the result ttl(or equivalent for dns) it gets from the upstream dns server.
Is there a setting to make dnsmasq keep dns answers longer ,maybe for a day?

Go to dnsmasq's page (http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html) and read what they say about extending TTL.

I have done that.
and added this to dhcp,conf
"option min_cache_ttl 28800"
but this doesnt work.

But "min_cache_ttl" does not seem to be supported by UCI: https://openwrt.org/docs/guide-user/base-system/dhcp_configuration; I think you need to add that option to "/etc/config/dnsmasq.conf" (https://openwrt.org/docs/guide-user/base-system/dhcp_configuration#using_plain_dnsmasqconf).

1 Like

thank you for the answer.
I tested it ( I remember that I did the same thing sometime ago with /etc/dnsmasq.conf ,there are no /etc/config/dnsmasq.conf ) and after 10 minutes it still works, so maybe it works now.
by the way, can this be added to UCI or am I missing something about UCI that doesnt allow this ,or is this just not added till now so just need a patch?

it didnt seem to work.
less than one hour later it again got the result from upstream server.
it may be a problem with dnsmasq in openwrt because the man page says that dnsmasq will extend short ttl to one hour but the dns server on openwrt doesnt cache it to one hour even after adding that option to /etc/dnsmasq.conf