1

I got a PC that I'm not using and it has some power.. I wanna have my own DNS server like a ISP has.. How can I go about this? I know linux so that's no biggy.. Thought this would be something fun to do :D

6 Answers 6

3

This is a little confusing since you describe another setup than you mention in the topic.

First Local DNS Caching

This is pretty easy to achieve using dnsmasq

To set this up install the dnsmasq package of your distribution. Since Debian based systems are common these days I'll assume this distro.

$ apt-get install dnsmasq

Now edit /etc/dnsmasq.conf and set the listen-address directive to the IP address of the network interface connected to your network.

Now restart the dnsmasq service

$ /etc/init.d/dnsmasq restart

Edit your resolv.conf and enter the nameservers supplied by your providers or another one:

# Google DNS 1 
nameserver 8.8.8.8
# Google DNS 2
nameserver 8.8.4.4

Now you can set your Linux machine as DNS server of your LAN clients and use DNS caching.

To test if it is working you might use dig

$ dig example.com

You will see something like

;; Query time: 38 msec

Now type the command again, and you should see something like:

;; Query time: 2 msec

ISP like real DNS Server

This would be possible using real nameserver software like bind. But if you have no experience on this you should probably start reading ahead at bind9.net since this would be to broad to answer.

1
  • +1 dnsmasq is as easy as it comes for a local dns server, whilst bind is better known maintaining a zone file can be a pain, where as an entry in /etc/hosts is much easier, you'll want yum install dnsmaq for redhat derived distros
    – Oneiroi
    Nov 10, 2010 at 20:29
2

There are only two caching recursive DNS servers that I can strongly recommend (avaiable both for Windows and UNIX variants)

  1. BIND (http://www.isc.org/)
  2. Unbound (http://www.unbound.net/)

The particular reason I recommend these two is DNSSEC - they both have full DNSSEC validation built-in. You won't get that with dnsmasq or tinydns.

BIND is generally considered to be the reference implementation of DNS, although I'd note that because it's a full general purpose DNS server it has lots of knobs and settings that a recursive-only server doesn't need.

Unbound was designed from the ground up to be recursive only. It's fast and lightweight.

1

Bind is the most popular: http://www.isc.org/software/bind

If you want something for windows, Windows Server has a DNS Server built in.

Not sure why you would want a local DNS server, it wont speed up DNS lookups necessarily. Keep in mind the DNS server has to run multiple queries before resolving to the IP. At a DSL or even cable, they will be slower than a DNS server at a datacenter with big pipes....

1
  • Do not use bind... Its is too much to configure and quite slow in comparison to others.. In fact some root servers have moved to tinydns (so i have heard)
    – Arenstar
    Nov 10, 2010 at 20:21
0

You kinda need a server OS to do that (as of what I know). I would install Windows Server (preferred 2003+) and install the DNS role. It has a nice little wizard that will help you set up your own DNS server.

I know that this isn't the only way, but it is a way that I am very familiar with.

-Good Luck

6
  • Why down vote? I said information that I'm familiar with, attempting to help at least a little. Add a comment if you are going to down vote.
    – David
    Nov 10, 2010 at 20:30
  • You do not require a server OS to provide DNS services, whilst windows server does come bundled with DNS services this is not true of all operating systems, and there are a multitude of standalone software applications that could run from your windows (eugh) desktop
    – Oneiroi
    Nov 10, 2010 at 20:33
  • I and didn't state that I was 100% sure that you need a server OS. I just know that it is ridiculously easy in windows server 2003. I don't think that is a reason to down vote.
    – David
    Nov 10, 2010 at 20:35
  • He did say, "as of what I know". Although the questioner stated that he knows linux, so obviously the guy is not looking for a $600+ solution. Nov 10, 2010 at 20:47
  • I wouldn't down vote, it's not a wrong answer and he didn't state server OS's were the only way to do it. The questioner did say he knows linux so he's obviously is not looking for $600+ solution. But still he's new give him time to learn when to answer and when not to. I know I read this site for more than 6 months before signing up for an account. Nov 10, 2010 at 20:50
0

Something cool and fast is TinyDNS/DNScache

its very simple to configure and maintain..

But by far for your needs..

I would suggest dnsmasq.. it will do the job your looking for..

Hope this helps :D

0

It's probably not worth it. Your server will still have to rely on an authoritative nameserver, and you probably won't have a connection to that authority that's nearly as fast as dedicated DNS servers such as what Google provides.

A couple of other things to consider: Most computers actually cache DNS entries locally for a certain period of time anyway. Furthermore, some modern browsers are now "prefetching" DNS info for links on a page - Google Chrome for example.

By the way - here is another post that provides a good answer should you still want to continue "for fun." in house DNS server

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .