The following mini-HOWTO is taken from a guide about how to configure dnsmasq as a caching nameserver, written by George Notaras and published under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 License.
What is a caching nameserver?
A caching nameserver is a DNS service that keeps a local cache of domain name to IP address mappings. Once the DNS information is cached, it is no longer needed to forward the queries to the upstream nameservers. This results in faster domain name resolution. This means that several tasks like web browsing or email processing by spam filters may get a little performance boost.
Both desktops and servers may benefit from using a local caching nameserver.
Why dnsmasq?
It is mature, lightweight and does the job efficiently.
Installation
Install using yum:
ConfigurationCode:yum install dnsmasq
Save the following configuration file in /etc/dnsmasq.conf
Save the list of the upstream nameservers in the file: /etc/resolv.dnsmasqCode:# # Configuration file for dnsmasq acting as a caching nameserver. # # Format is one option per line, legal options are the same # as the long options legal on the command line. See # "/usr/sbin/dnsmasq --help" or "man 8 dnsmasq" for details. # # Updated versions of this configuration file may be available at: # # http://www.g-loaded.eu/2010/09/18/caching-nameserver-using-dnsmasq/ # # # Basic server configuration # listen-address=127.0.0.1 port=53 bind-interfaces user=dnsmasq group=dnsmasq pid-file=/var/run/dnsmasq.pid # # Logging # #log-facility=/var/log/dnsmasq.log #log-queries # # Name resolution options # domain-needed bogus-priv no-hosts dns-forward-max=150 cache-size=1000 #no-negcache neg-ttl=3600 resolv-file=/etc/resolv.dnsmasq no-poll
The following IPs are used as an example. Use the IP addresses of your ISP's DNS servers.
Start the dnsmasq service:Code:nameserver 192.168.0.252 nameserver 192.168.0.253 nameserver 192.168.0.254
Make the system use the dnsmasq service for domain name resolution:Code:/etc/init.d/dnsmasq start
Enjoy!Code:echo "nameserver 127.0.0.1" > /etc/resolv.conf
For more details about the used directives plus some tips about logging to file, please read the full dnsmasq guide.


Reply With Quote
