Our office server serves different websites based on hostname, e.g. wiki.os, icons.os, an entry for many client projects etc. We perform the name resolution via the hosts file on every single pc in the office. This is a real pain as the list changes from time to time.

I would like to use the office server as the nameserver for the pcs in the office and let it return the usual nameserver results PLUS our custom local dns entries for the office server, so every pc connected in the network can use the names. Currently, the nameserver used is the router. The server runs on Debian.

What would be the best way to do this? Do I have to set up a complete BIND server or is there a little, sneaky tool I missed? Any suggestions?

Greetings, Steffen


I have used dnsmasq to provide local dns services in my home network and it is also known to be able to serve way beyond 1000 hosts. Dnsmasq will serve names from the /etc/hosts file, provide dns-caching and it also contains a dhcp server. The dhcp part is disabled by default.

On Debian the installation procedure goes like this:

apt-get install dnsmasq

Dnsmasq will per default ask the nameservers in resolv.conf if it's own cache or the local hosts file lacks a suitable entry.

I also use dnsmasq at work to provide dns-caching and it's effect is very noticeable.

  • 1
    dnsmasq is the easiest way to do this. Don't bother with a full dns implementation like bind for such a simple setup – goo Jul 7 '09 at 7:46
  • You can also use address=... under /etc/dnsmasq.d/somefile.conf to specify custom addresses. Make sure to run restorecon -r /etc/dnsmasq.d/ whenever you create files in there. – akostadinov Mar 11 '19 at 17:09

Setting up BIND on Debian really isn't a big deal. See: http://www.langfeldt.net/DNS-HOWTO/BIND-9/DNS-HOWTO.html for just one of many BIND-related HOWTO documents. This particular HOWTO moves in a very step-by-step manner and is pretty easy to follow.

Whatever you do, you've made the right decision to stop using HOSTS files. (I am nearly bleeding from my eyes just thinking about using HOSTS files...)

| improve this answer | |

You might want to check out tinydns and dnscache, which proved the exact functionality you need and are both secure and easy to maintain at the cost of being tools that are built in a quite, let's call it 'unique', way.

Grab a tutorial here.

| improve this answer | |

I strongly agree with DGnome. Using dnsmasq is the best solution for your environment, not only because you already have a complete hosts file.

But please make sure to not activate the DHCP server part of dnsmasq if you have another DHCP server running on your network.

To achieve this, make sure there are no active (without leading "#") dhcp-range= lines in your dnsmasq.conf and/or use the no-dhcp-interface= option.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.