Monday, August 30, 2010

Cache Only Local DNS Server using dnsmasq

dnsmasq is the most popular caching DNS choice for small-to-medium deployments is which is both a lightweight DNS server and a lightweight DHCP server. It is a standard package in modern Linux distributions. If your distro doesn't provide it, though, you can download and install the source without too much trouble; there are no major external package dependencies.

Installing dnsmasq on Fedora

# yum install dnsmasq

Configuration

Open the file /etc/dnsmasq.conf as root. There are several dozen configuration options -- all of them well-documented -- but it only takes a few to get set up for normal use.  Near the top, uncomment out the listen-address= directive and add the localhost address 127.0.0.1: listen-address=127.0.0.1. This tells dnsmasq to listen for DNS queries that originate on the local machine.
 

listen-address=127.0.0.1 
 
Edit /etc/resolv.conf, and add nameserver 127.0.0.1 to the top. The locally-running copy of dnsmasq will now receive all DNS queries first, and cache the results.


Starting dnsmasq Service
# /etc/init.d/dnsmasq start


No comments:

Post a Comment