Saturday, 7 September 2013

In any computer network, the computers basically exchange information among themselves with the help of IP addresses associated with them. For instance, when you are accessing google.com for some searching purpose, in fact, your system is communicating with one of the several web servers set up by google.com using its IP address. Howsoever, if the computers are efficacious with numerals, we the humans, on the other hand, do better with the names. For this cause, the TCP/IP protocol comprises the Domain Name System (DNS) to establish a relation between IP addresses and computer names (hostnames). The DNS is a distributed database of computers which is liable for determining the hostnames against the IP addresses and vice-versa.

A DNS query consists of two parts:

The Resolver: The resolver sets up or generates the query. The resolver itself would never run as a program. For example, /etc/resolv.conf is a resolver.

Name Server: It is the service which keeps running in the server and it replies to the DNS query initiated by the resolver i.e. responds to the question asked by the resolver.

Fully Qualified Domain Name (FQDN)

The fully qualified domain name of any server is nothing but the full name of that server. As every human is identified with a full name in the real world, every web server available on the Internet needs a full name to get identified. The structure of a FQDN is-

host_name(dot)domain_name(dot)top_level_domain

For example, in www.yourownlinux.com, www is the host name (of the web server), yourownlinux is the domain name and com is the top level domain (TLD).

Content Servers

A content server is the one that basically maintains authoritative DNS records. These records are nothing but single pieces of information like:

The name www.yourownlinux.com refers to IP address xx.xx.xx.xx

All the mails coming to the domain yourownlinux.com should be delivered to the IP address xx.xx.xx.xx

The IP address xx.xx.xx.xx has the name xyz.yourownlinux.com, and so on.

These records are termed as 'Authoritative', as the owner of the server asserts that those are true and accurate in the global naming system, and they provide a content DNS service to supply these answers to anyone who demands for them. Generally, content servers are authoritative for a certain set of domains, possessed or administrated by the individual who has set up the server.

When a content server is not able to provide an answer to a certain DNS query, it may know the information if the domain is delegated to some other server, and thus can answer using a referral instead. A referral is an indication to the client telling that it will try to get the answer from some other content server.

Resolving Servers

A resolving server's task is not to provide any authoritative information immediately. Its task is to look for the information as a representative of clients, and to give it back. Typically, a resolving server stores past queries so that when someone demands for the same information, it should give it back to the earliest without searching for it once again. For this reason, a resolving server is also called as a "DNS Cache" or "Caching DNS Resolver".

The Root Servers

As noted earlier, the DNS is a distributed database. When a DNS server is unable to answer to a query, it dispatches that query to the next server residing upper in the hierarchy. The query continues to travel upwards till it hits the root. Originally, there are total 13 root servers (10 of which are in US, 2 in Europe and 1 in Japan) responsible for all the DNS activity in the world. These root servers are divided alphabetically as a.root-servers.net to m.root-servers.net. These root servers have been replicated to raise the count of root servers to 349(?). These root servers keep sharing information among them continuously and keep updating each other with whatever they know.

Working of DNS

The client generates a query to look for www.yourownlinux.com. The client already knows the location of the resolving DNS server, which is typically the DNS server of its Internet Service Provider (ISP), through its network configuration (/etc/resolv.conf file). Thus, the client forwards the query to DNS server of the ISP.

Firstly, the DNS Server of the ISP inspects it's own cache to examine whether the answer is already available or not. If the answer is not available, it initiates another query. As the top level domain of www.yourownlinux is .com, the DNS server queries the root server (they have globally well-known addresses) to check who is responsible for yourownlinux.com.

The root server does not have the answer the query (www.yourownlinux.com) generated by resolving server (ISP), but it provides IP address of the server that knows .com domains.

Then the resolving DNS server asks the .com server about the IP address of www.yourownlinux.com

The .com server replies that it doesn’t know about www.yourownlinux.com, but responds back with the IP address of the server that knows about .yourownlinux.com domain.

The resolving DNS server asks .yourownlinux.com about the address of www.yourownlinux.com

Then the server of .yourownlinux.com responds the query with the IP address of www.yourownlinux.com and thus resolving DNS finally gets the answer.

It replies the client with the IP address of www.yourownlinux.com and an index.html page.

That's all for this article. Feel free to share your valuable opinions and feedback in the comment section. Stay tuned for more Networking articles.