What are DNS Servers and How do they Work?

DNS stands for Domain Name Service. And a DNS Server is a web server that communicates and tells people / computers where written out host names and domain names exist on the Internet. It does this by translating a domain name, example: www.phillihp.com and forwarding it to a particular IP address, example:

Because I wrote a lot, here’s a very quick and short video if you want to skip the rest.

Now to walk you through all of the connections.

Registering a Domain

Each and every domain name has an associated set of Name Servers that they belong too. These name servers point to the particular DNS that knows exactly where all of the domain’s content and data exist. But we do not point the domain until we have completely setup the DNS route. The first part is to register a domain name with a Registrar. A Registrar is a central contact (You know of these companies: GoDaddy, Network Solutions, Verisign, Namecheap), who directly communicates to all of the Internet Service Providers (ISP’s) in an orderly fashion. This is dictated by the non-profit corporation ICANN. At your registrar, you create your domain, such as phillihp.com.

Setting up Name Servers

With that domain, you can register Name Servers such as NS1.phillihp.com and NS2.phillihp.com. Name Servers provide the IP address of where the DNS Server actually is referenced. This registration with the Registrar replicates out to all majorly known ISP DNS Server caches, which in turn, lets your computer and everyone else’s, know where you live. You can setup Name Server’s on any Registrar, like GoDaddy, NameCheap, Network Solutions, etc…

Setup DNS

Once your name servers are setup with the Registrar, you want to stand up a Domain Name Service (DNS) on that server that you specified in your Name Server registration. You can do this on a single box or multiple boxes. We tend to stick with two, for redundancy purposes. Anyone can set this up, just as long as they have an IP that is static and public, meaning it does not change and it is externally available to the internet. If you are on Windows, even Windows 7, Mac, Linux, there are packages for any build. And most all of them are free!

Here are a list of DNS packages:

  • The most widely used DNS server, BIND, has a ntbind variant.
  • Microsoft DNS is included with Windows Server.
  • Simple DNS Server which is, lets face it, simple.
  • MaraDNS is a security-aware DNS server.
  • Unbound is BSD licensed.
  • Posadis is GPL licensed, compatible with BIND files.

Or if you have an advanced enough router, you can setup your DNS there as well.

Once you have your DNS Setup, you need to setup Zone’s. Each Zone will consist of a domain name, which has a set of records, such as A, CNAME, and MX records. So, we will setup a zone called “phillihp.com”
A Record – Address record, similar to a domain name. You can create a subdomain.phillihp.com and point to anywhere you want in the world by IP Address.
CNAME Record – Alias record, point copy.phillihp.com to subdomain.phillihp.com and it will forward to where ever subdomain.phillihp.com is going
MX Record – Maps a domain to a list of message transfer agents. Typically setup for Email.
NS Record – Name Server record – Here we should additionally setup “phillihp.com.” to our “NS1.phillihp.com.” and “NS2.phillihp.com.” so that we internally know who our Name Servers are without have to go to our ISP to ask. Notice the periods at the end of the domain, that finishes the doman request.

Those are really the only important ones you need to know.

Binding Hostnames

Now that we are pointing the domain name to a server, we need to configure that server to bind that domain name / host name to a particular website. In Windows/IIS, you edit your websites “Bindings” and add the appropriate host name, subdomain.phillihp.com to the website you would like bound, as well as the allowed IP address requested. And on Apache, you can set this up in your HTTPD.CONF file typically stored under /etc/apache2/conf/httpd.conf. It could also be in /usr/local/apache/conf/httpd.conf, depends on how you are setup. You can always search for it using this command: “find / -name httpd.conf”

Switch Domain to Name Server

Alright, we have everything configured from A to Z execpt that your final configuration is getting that domain name to point to your pre-configured Name Server. This is always the last step as you should never really point everything until you have the entire stream setup. Log into your Registrar (GoDaddy.com or whomever) and configure your domain name. Now point to your name servers created at the very beginning, click Save, and that’s it! You should have a newly setup entire DNS route.

I know my instructions are a bit vague, but that is the general overview. DNS for Windows is the same for Linux. Security is a small concern if you are running a Linux box and records are extremely easy to setup and configure.

Below, I did a chart of a basic user to domain to web server route. I may have excluded caching and things of the sort, just to try and keep it simple.

And here’s a more detailed one that I particularly liked:

About Phillihp Harmon

I'm Phillihp. My name can be spelled the same way forwards and backwards, so can my posts... if you wish. I'm out here exploring, learning, and sharing what I find. This is more for fun and personal growth, I aim to be as consistent as possible, so check back daily!
This entry was posted in ***, Cloud Computing, DIY, Home Projects, howto, Internet, Linux, Windows. Bookmark the permalink.

One Response to What are DNS Servers and How do they Work?

  1. Pingback: Free DNS Servers – World of Name Server Routing | phillihp's tech blog – Phil's Tech Blog

Leave a Reply

Your email address will not be published. Required fields are marked *