Inside the DNS (Domain Name System)

Spread the love

The DNS (Domain Name System) is the backbone of the Internet.

Domain Name System
Domain Name System
Domain names.

The big trick behind the  DNS  is a that it’s a distributed database. This allows it for every owner of a Domain  to manage their own part of the DNS (their own domain).

You may already know that the DNS maps IP addresses to hostnames. For example the page where you are looking at now is on a webserver which is installed on a machine with an IP Address of 149.210.197.2 and it has the hostname ewagenaar.com. The mapping allows Internet client software to easily connect to the host just by entering it’s name. Why is the IP address important? Computers don’t understand names, in a Computer network the machines can only connect to each other by using the numerical IP addresses which we see as a series of numbers, separated by dots.

Subdomains

To understand Subdomains we first need to know about the Topdomain (or TLD, Top Level Domain). In the case of ejwagenaar.com the TLD is ejwagenaar.com and I since I am the owner of this domain, can do anything I want with it, like for example adding an FTP server. To do this I can change the zone file of my domain and add an entry ftp.ejwagenaar.com. In the same way I could add a mailserver (mail.ejwagenaar.com) or a webserver (www.ejwagenaar.com). In reality the webserver already exist. You can check it out by going to http://ejwagenaar.com/ and http://www.ejwagenaar.com/As you can see they both do the same thing; Opening my website at the homepage.

I’m not limited to this. I can also add Servers like FTP (ftp.ejwagenaar.com), an SMTP server (mail.ejwagenaar.com) or a game server (games.ejwagenaar.com). I can even create sub-sub domains: (zimba.mail.ejwagenaar.com) or if you want your own Subdomain under my domain johndoe.ejwagenaar.com, which you then are responsible for and create an unlimited amount of hosts for. This would require me to setup my own DNS. To comply with this I would have to add the DNS(es) to my domain. These would be ns1.ejwagenaar.com and ns2.ejwagenaar.com. At present these don’t exist yet because there’s no need for doing this.

As you see the DNS is a hierarchical system. Considering of Domains and Subdomains. What is the Top Level Domain of my own Domain ejwagenaar.com? It is the ‘.com’ TLD and it is managed by the DNS root servers.

The nice thing about this is that you only need one single DNS to find all names on the Internet. How does this work?

As we already saw, all Domains are connected with each other trough an hyrarchic system where each domain has it’s own Domain Name Server which is authorized to hold it’s own zone (the list of all hosts and their IP-Addresses. We say that the DNS is authorities for it’s own records. You can see this when you use the program nslookup. This is a command line tool and comes standard with Windows, MacOS and Linux. It allows you to query DNS servers.

When you query a DNS server for names in it’s own zone it will list the output with ‘A’ characters in front of the hostnames and IP-Addresses.

Replication

To make Domain lookups faster, Domains and Subdomains can exchange their data. In DNS termology this is know as zone transfer.

How does a lookup work?

The name lookup works recursive. It starts at the Top Level Domain (TLD). In my case this is the ‘.com’ domain, which has its DNS servers in the root Domain Servers. Here the ‘Authorative’ DNS server for ejwagenaar.com is looked up and the request is forwarded to that DNS. The DNS gives an ‘A’-reply and the name is resolved.

You probably can imagine that this process takes a lot of time to complete. In reality it usually takes only a few milliseconds. This is accomplished by the zone transfers together with  a smart caching system.

Book

DNS and BIND (O’Reilly)

One thought on “Inside the DNS (Domain Name System)”

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.