Adding custom dns entries for name resolution in the local network

23,978

Solution 1

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.

Solution 2

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...)

Solution 3

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.

Solution 4

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.

Share:
23,978

Related videos on Youtube

Steffen Müller
Author by

Steffen Müller

Updated on September 17, 2022

Comments

  • Steffen Müller
    Steffen Müller over 1 year

    Hi!

    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

  • Ketan
    Ketan almost 15 years
    dnsmasq is the easiest way to do this. Don't bother with a full dns implementation like bind for such a simple setup
  • akostadinov
    akostadinov about 5 years
    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.