Monday 5 October 2009

DHCP and DNS using DNSMasq

If you are not configuring an internet facing nameserver to resolve your own FQDN then you really don't want to use ISC BIND.

In cases where you want to simple domain in a home or office with caching and dhcp then the by far the simplest tool to set up is dnsmasq.

sudo apt-get install dnsmasq

Once installed you can configure it by editing dnsmasq.conf

sudo vi /etc/dnsmasq.conf

The config file is very well documented and should be self explanatory. For a simple DNS setup you probably want to modify the following two lines;

server=202.27.184.3
local=tuxnetworks.com


For server use your upstream (usually your ISP) dns server.

For local use the domain you want to use on your LAN.

To use DHCP modify these lines;

domain=tuxnetworks.com
dhcp-range=10.1.1.10,10.1.1.150,12h


You can do some other neat stuff too, like assign static addresses by hostname or mac address, specifiy specific servers for specific domains and other geeky fun things. Most of it is documented in the config file, I encourage you to read through it.

If you put IP and name entries into /etc/hosts then dnsmasq will use that to resolve names and pass them on to clients, easy peazy!

No comments: