Tomato Firmware as DNS Server

If you’re a home user, using the Tomato Firmware on a device, such as the Linksys WRT54GL, and you don’t have an internal DNS server, then Tomato might be able to save the day. For myself, I’ve got several computers on my internal LAN, and do not have an internal DNS server. Each of these computers is running Windows 7 in workgroup mode – as opposed to being an Active Directory domain member (which would require internal DNS). Manually populating the HOSTS file on my Tomato router was not an option, as I am using DHCP all around, and am not interested in the time overhead of manually maintaining a list of device-to-IP mappings.

Since Tomato uses the DNSmasq Linux software, I began investigating how I could go about using it as a DNS server. The manpage for DNSmasq is, as with most manpages, excessively informative. After paging through all the various options, and doing some Googling, I found the “–domain-needed” command line switch. According to the manpage, all I needed to do was append any command line switch to the dnsmasq.conf file, without the “–” prefix, that is normally used on the command line, in order to use this option. Basically, what –domain-needed does, is require that any DNS queries sent to the DNSmasq must be a fully qualified domain name (eg. www.google.com), rather than simply a hostname (eg. “www”). Since I don’t need to resolve hostnames, without domain names, outside of my network, I went ahead and turned this option on. Because DNSmasq also supposedly automatically responds to DNS queries for DHCP-registered hosts, it should now avoid forwarding these hostname-only queries to the configured DNS forwarder, and respond to them directly.

I’ve included a screenshot below of the working DNSmasq configuration in Tomato, as well as a test DNS query using nslookup.exe.

Performing a hostname-only DNS query

Performing a hostname-only DNS query

DNSmasq.conf

DNSmasq.conf

One thought on “Tomato Firmware as DNS Server

  1. Pingback: Les commandes GNU/Linux qui vous feront gagner du temps

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>