Dnsmasq

Summary
Dnsmasq is a lightweight, easy to configure Domain Name System (DNS) forwarder and Dynamic Host Configuration Protocol (DHCP) server. It is designed to provide DNS, and optionally DHCP, to a small network. It can serve the names of local machines which are not in the global DNS. The DHCP server integrates with the DNS server and allows machines with DHCP allocated addresses to appear in the DNS with names configured either in each host or in a central configuration file. Dnsmasq supports static and dynamic DHCP leases and Bootstrap Protocol/Trivial File Transport Protocol (BOOTP/TFTP) for network booting of diskless machines.

Dnsmasq is targeted at home networks using network address translation (NAT) and connected to the Internet via a dial-up, cable or ADSL modem connection, but would be a good choice for any small network -- up to 1000 clients are known to work -- where low resource demand and ease of configuration are important.

Features

 * The DNS configuration of machines behind the firewall is simple and doesn't depend on the details of the ISP's DNS servers
 * Clients which try to do DNS lookups while a modem link to the Internet is down will time out immediately.
 * Dnsmasq will serve names from the file on the firewall machine: If the names of local machines are there, then they can all be addressed without having to maintain  on each machine.
 * The integrated DHCP server supports static and dynamic DHCP leases and multiple networks and IP ranges. It works across BOOTP relays and supports DHCP options including RFC3397 DNS search lists. Machines which are configured by DHCP have their names automatically included in the DNS and the names can specified by each machine or centrally by associating a name with a MAC address in the Dnsmasq configuration file.
 * Dnsmasq caches Internet addresses (A records and AAAA records) and address-to-name mappings (PTR records), reducing the load on upstream servers and improving performance, especially on modem connections.
 * Dnsmasq can be configured to automatically pick up the addresses of its upstream nameservers from PPP or DHCP configuration. It will automatically reload this information if it changes. This facility will be of particular interest to maintainers of Linux firewall distributions since it allows DNS configuration to be made automatic.
 * On IPv6 enabled boxes, Dnsmasq can both talk to upstream servers via IPv6 and offer DNS service via IPv6. On dual-stack, IPv4 and IPv6, boxes it talks both protocols and can even act as IPv6-to-IPv4 or IPv4-to-IPv6 forwarder.
 * Dnsmasq can be configured to send queries for certain domains to upstream servers handling only those domains. This makes integration with private DNS systems easy.
 * Dnsmasq supports MX and SRV records and can be configured to return MX records for any or all local machines.

Basic Installation
Install the package

Start/Test the program

Set it to start at boot (optional)

Setup/Customize the DNS Server
Edit using your favorite editor define the DNS entries you want to server. ex.

Add the following to your network configuration. (assumes eth0 and OpenDNS so change things accordingly)

Force the changes to take effect by restarting the service/daemon using:

Automatic Configuration Reload Script
This section of the setup is purely optional. Without it you will have to restart the Dnsmasq service or the computer in order for any changes to take effect. With the following script it can be monitored and done automatically.

Open a new file with your favourite text editor, nano is used here:

And copy and paste this script: /etc/cron.hourly/dnsmasq-config-monitor.pl

Make the script executable.

Create a cronjob for the script to be run automatically every 5 minutes (Optional)