I want to create a DNS Server (like Google does - I understand that a DNS Server is a Server that gives a IP on being given a hostname, ie. when I ask it what is the IP of google.com, it says "".

So, what I want to do is create a similar one that holds records of what translates to what. I thought of this since it looks to be similar to a webserver - ask for a page and it gives back the page. That is, when my machine has the IP xxx.xxx.xxx.xxx and people chose xxx.xxx.xxx.xxx as their Primary DNS Server, then when they ask "www.google.com", I sould be able to tell "".

So, how do I create this DNS Server that is accessible to everyone in the world ? It would be easier if we have something like EasyPHP which is the analogue to a webserver here.

  • Why do you want to do that?
    – j0k
    Dec 8, 2012 at 10:55
  • I just want to learn how to do this, might be useful when I am in a situation where I need to do this. Also might help the world.
    – user20492
    Dec 8, 2012 at 10:57
  • No need to cross post on multiple sites at the same time: serverfault.com/questions/456315/creating-a-dns-server
    – LazyOne
    Dec 8, 2012 at 16:16

3 Answers 3


You want to build a website that stores all DNS records? Well in the 90's you could have run commands such as host -l -v -t any com and get a list of all the `.com' domains along with some other information. That no longer works.

You can sign up with Verisign and purchase .com .net .org and maybe some other zone files but that's certainly not all the domains in the world which you seem to want records of. You would need quite a few servers to process those files since they are usually gigabytes of data. This isn't efficient, especially since the files are updated daily and you wouldn't really be able to keep your site updated cheaply.

The easiest method is to simply write a server side script to do the nslookup on the IP or domain provider and return the results. One such site is http://network-tools.com/nslook/ and there are many more like it. Is that what you were asking about building?


I'll try to answer as best I can, but I'm new to this site as well.

DNS servers can basically be made on 2 platforms: on Linux/Unix or on Microsoft.

I'm going to make an educated guess and say that you're more familiar with Microsoft (MS) products than Linux. If that's wrong, let me know and we can discuss something in Linux. In MS world, you could download Server 2008 operating system and virtualize as in this tutorial http://www.sysprobs.com/install-run-windows-2008-r2-x86-sun-virtualbox to do just that. Once inside, go to server manager and either just install the dns role or promote your computer to a domain controller (this will automatically give you dns server) as in this http://www.techrepublic.com/blog/datacenter/how-do-i-install-and-configure-a-dns-server-in-windows-server-2008/327 tutorial.

Once you get to that point, open dns through administrative tools and it's all downhill from there. Add zones, host records, mx records, try different things. It's all on the tabs of the dns tool. If it's virtualized you can't really mess up too much.

As for how to make it accessible to the world. You'll need to open the dns related port on the router. That just makes the server accessible. For anyone to actually use it, they'll have to trust you. So you'll need to have some reason for other DNS servers to want to forward their requests to you. Unless you're the primary zone for some underlying network (like the DNS for IBM or Coca Cola or the country of Argentina, etc.) then you might have a tough time getting traffic. Remember that DNS servers don't know you and don't trust you, especially due to the large number of toxic and malicious attempts to subvert DNS requests. Assuming that you're not trying to do that, then get some underlying network and you'll be on your way. Try advertising.

  • Well DNS could be setup on Vax/Open VMS though that was back in the 90's. *nix is the way to go IMHO.
    – Anagio
    Dec 10, 2012 at 10:40
  • Totally, I'd go with 'nix also. But don't discount MS, if you're talking about the 90's, MS has improved server OS's drastically since then. MS is more widely used (in retail not servers, so most general users know MS), and this isn't the networking forum so I wanted to answer in a way everyone can understand. That's why I said 'basically', there's others technically that have existed or theoretically you could even program one yourself. Just wanted to keep it straightforward and practical so that it's as useful as possible here.
    – stackuser
    Dec 10, 2012 at 15:40

I assume that you are not talking about setting up a root name server.

Apart from the fact that you should be sure why you need a publicly accessible DNS server, the procedure to set one up is quite simple. Usually, you would set up a DNS server which has records of the IP addresses and corresponding host names for your local network. If it is asked for some other host (e.g. host "www" on the domain "whitehouse.gov"), it will ask another DNS server for an authoritative answer and pass the answer on to the client.

The standard DNS server software is Bind, which is open source and can be compiled for all platforms you may think of. It is well documented. Apart from the IP/host name records you need to cover your local network (which nobody else knows, and probably not even sees behind a NAT service), you need to point Bind to the root name servers, usually through a file called root.cache. Then you need to announce your DNS to the hosts on your(!) network, e.g. via DHCP.

If your network is publicly accessible and you need to provide DNS (meaning not only access to the NAT gateway, and the occasional "www", "ftp" or "shell" host of your own domain), you should probably not proceed as a complete newbie ;-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.