Tomato Cache Optimization with DNSMasq and DNS Benchmark

Want to speed up your internet’s resolution of websites?  One way is to flash your router with Tomato (Tomato is Linux core firmware for many routers that provides advanced features.) or other open source firmware.  Below is an example of how to cache DNS queries using Tomato’s firmware.

So what is DNSMasq?

DNSMasq a lightweight DNS, TFTP, PXE, router advertisement and DHCP server. It is intended to provide coupled DNS and DHCP service to a LAN.

Dnsmasq accepts DNS queries and either answers them from a small, local, cache or forwards them to a real, recursive, DNS server. It loads the contents of /etc/hosts so that local hostnames which do not appear in the global DNS can be resolved and also answers DNS queries for DHCP configured hosts. It can also act as the authoritative DNS server for one or more domains, allowing local names to appear in the global DNS. It can be configured to do DNSSEC validation. ~Read more at –

So how can you make the internet faster?  During name resolution, your router can act as a small DNS server with DNSMasq.  Optimizing the cache and webpages will resolve almost immediately.

First, download DNS Benchmark from GRC and find the fastest DNS servers in your area.

Next, click on Basic and Network.   Enter the DNS servers that you found best for your area.


Click save when you finish.

Next click on Advanced and enter the following information under Custom Configuration.


By default, 150 queries can be cached by default but with dozens of devices in homes today, this allows for 2048 queries (below).   The maximum is 10,000.

4 DNS Script

Once you click enter the information, click on save.   To fully flush the DNS information, reboot the router and on your computer, go to a command prompt as an administrator and type ipconfig /flushdns.

For Mac OS X El Capitan, Mavericks and Mountain Lion, go to a terminal and type:
sudo killall -HUP mDNSResponder
For Mac OS X Yosemite, type:
sudo discoveryutil udnsflushcaches

To verify my settings, I connected by telnet into the router.  (I also changed my cache to 4096 on my router).  If you decide to telnet into your router, you will have to enable telnet on the router and add telnet to your computer under program and features (you will have to add telnet).

By typing cat /tmp/etc/dnsmasq.conf, you can verify the information was programmed into the router.

1 Telnet2 telnet results

Want to make sure your router is answering and resolving names?  Go to a command prompt and type nslookup  You should see your router and the IP address information for the domain.


You can also see the mail server for the domain by typing something like this –

set type=mx

About TCAT Shelbyville IT Department

The Tennessee College of Applied Technology - is one of 46 institutions in the Tennessee Board of Regents System, the seventh largest system of higher education in the nation. This system comprises six universities, fourteen community colleges, and twenty-six Applied Technology Colleges.
This entry was posted in Home Networking, network, Networking, Technology and tagged , , , , , . Bookmark the permalink.

One Response to Tomato Cache Optimization with DNSMasq and DNS Benchmark

  1. Bingout says:

    wow..thats very detailed and nformative articles..thanx for sharing 🙂

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s