Ridiculously easy home DNS/DHCP Setup


I had been meaning to setup internal DNS/DHCP since we moved into our house back in 2001. I kept putting it off because I was not looking forward to getting intimate with bind. I got lucky and found out about an awesome tool called dnsmasq.

I would have probably never done this had two things not happened:

  1. I needed to enumerate everything on my wireline network
  2. My laptop backups started to fail

When I listed everything on my wireline network I had:

  1. PlayStation 2
  2. DLink DNS-323 NAS
  3. Desktop Computer
  4. IOSlave computer
  5. Personal Laptop
  6. Work laptop
  7. Log Host
  8. PIC Programming host
  9. DLink DSM-320

The challenge I have is that I host a couple of websites on my home computers. This causes problems when I use the website address from within my home network - basically it can't resolve properly. My work-around was to have two sets of bookmarks for those items but that's pretty ugly.

What I really needed was a way of having the URL resolve correctly from within my home network.

In the list above you'll see IOSLave. This machine handles most of the drudge work in my office. It now also assumes the DNS/DHCP server duties - this was formerly handled by Linksys BEFSR-41.

Step 1: disable the DHCP server in the Linksys BEFSR-41.
Step 2: Install dnsmasq
Step 3: Configure dnsmasq

Installation of dnsmasq is trivial - many Linux distributions include this package. IOSlave is running an ancient version of Slackware so I installed from source which was simply a matter of running make install.

The configuration of dnsmasq is where the payoff is. In my case I wanted to do a couple of things:

  1. Resolve short names within my local network
  2. Use DHCP for local machines
  3. Be able to find DHCP assigned machines on my local network
  4. Re-direct select external names to local machines

dnsmasq can be configured by the contents of /etc/dnsmasq.conf and by command line arguments. I chose to modify the config file because I didn't want all the arguments showing up on a 'ps'.

The example dnsmasq.conf file included in the package is almost what I needed, just a few tweaks:

  • Networked attached storage is always referred to by NAS:
  • Loghost has a fixed IP address so I needed to add this line:
  • Because the loghost has a fixed IP address it will not be found in the dhcp leases file:
    Force Loghost to resolve by shortname:
  • Similarly, force name resolution for a couple of sites:
    • address=/site1.url.com/
    • address=/site2.url.net/

That's it, really really painless.

dnsmasq homepage