I need to setup my router to use opendns. It have the latest DDWRT firmware. But I want the router to act as a DNS server so it will cache the queries. I have set the Additional DNSMasq Options as follows :


I have set the openDNS server for static dns servers and have added the following firewall rules to the router :

iptables -t nat -A PREROUTING -i br0 -p udp --dport 53 -j DNAT --to $(nvram get lan_ipaddr)
iptables -t nat -A PREROUTING -i br0 -p tcp --dport 53 -j DNAT --to $(nvram get lan_ipaddr)

According to this setup, Will the router forward all the dns requests to opendns without caching or will it cache?

  • Your router won't cache the dns requests but your computer will cache the dns information your router provides. – Ramhound Nov 28 '12 at 16:17
  • @Ramhound How to set the router to cache the requests? – THpubs Nov 28 '12 at 16:35
  • Your question wasn't clear so I provided an incorrect answered. How did you come up with that command if you don't know what it does? – Ramhound Nov 28 '12 at 17:45
  • @Ramhound Through the DDWRT wiki :) But there's no detailed explanation in there – THpubs Nov 29 '12 at 1:41
  • OpenDNS is a poor choice as it will insert ads where there should have been an NX reply. This can sometimes cause software to malfunction. And ads are something you should avoid. Pick a better DNS provider. And besides, spoofing DNS is hardly a proper security measure, no matter what you are trying to do. – Zdenek Dec 5 '16 at 16:43

On the Services tab, under Additional DNSMasq Options, you can set these two options:


From the DNSMasq man page:

Cache-size: Set the size of dnsmasq's cache. The default is 150 names. Setting the cache size to zero disables caching.

  • Hi, I need to enable caching and set it to first query opendns and then cache those requests – THpubs Nov 28 '12 at 17:02
  • 1
    @EApubs - So instead of setting the size of the cache to 0 pick some other number? – Ramhound Nov 28 '12 at 17:36
  • 1
    Yes. The number indicates the number of names that will be cached. – Ian Atkin Nov 28 '12 at 18:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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