After Covering HTTP, FTP and SMTP, now we will discuss about another Application layer protocol, Domain Name System(DNS).
Before starting I would like to ask you , how do you identify human beings. I am sure , your answer will be , by their names. But I want to tell you that , there are also other ways of identifying a human being. Such as from their Driving License, from their passport Number etc. For example, If you work in a industry, where 1000’s of employees work. And there is a database, that store the information of every employee according to the Serial Number id of that employee.
So for the database, your serial id is an appropriate option to remember you. But your friend will not use that serial id, he will call you by your name only. Therefore, we humans can be identified in different ways, those different ways can be used for different preferences where appropriate.
Similarly the Internet hosts are identified in many ways. One way is to identify them by their host names.
For Example : Hostname can be www.google.com, yahoo.in , network.edu etc. But these host-names are appreciated by humans only because hostnames are easily readable by them.
Hostnames provide some information about the host. Say, if a hostname is www.school.edu.fr. Thus the .fr at the last refers that the host might be located in France. Except that it tells nothing.
But hostnames can be of variable lengths. What about the routers. it will be difficult for them to process these variable length hostnames. Therefore, for these reasons, hosts are also identified by IP-addresses.
IP address are the fixed length numbers. These are of 32 bits or 4 bytes such as 184.108.40.206. Each of the 1 byte or 8 bits separated by a decimal, can contain number for 0 to 255. These 4 bytes follow a hierarchical structure. For example, if you read a postal address on a letter, you will keep getting a more idea as you go down reading it, that where the address is located. In the same way, as we keep scanning the IP address from left to right, we will keep getting more and more information about the host, where it is located.
Importance of Domain Name System(DNS) : Above we have discussed two ways of identifying a host. Either by their hostname or IP address. Human prefers hostname while the routers prefer IP addresses. Therefore to fulfill these preferences, it is a need that there should be directory that transforms the hostnames into routers understandable IP addresses. This work is done by Domain name System(DNS). It transforms the hostnames into their respective IP addresses.
Therefore we can say that, DNS is a database or a distributed database that is implemented in a hierarchy of DNS servers.
Lets discuss this with an example. Say, you type a URL in your Browser ( a HTTP client), http://fitnytech.com/ images.png. Thus, for the client host to send the HTTP request to the Web Server www.fitnytech.com, the user host must obtain the IP address of www.fitnytech.com. These are the steps that took place when you type the URL in the Browser and press Enter.
1. The user or the client machine executes the client side of the DNS.
3.The DNS client sends a message containing the hostname to a DNS server.
4. The DNS server replies back with the IP address of the requested hostname to the DNS client.
5. Now the browser receives the IP address from client DNS, it can setup a TCP connection to the HTTP server at that IP address. ( Connection with HTTP process at port 80).
- You must have noticed that except a HTTP request-response, now there is a added DNS request-response also, resulting in the additional delay.
The DNS servers are often UNIX machines running on the Berkeley Internet Name Domain (BIND) Software. And the DNS protocol runs over UDP at port 53.
A hostname can be very complicated to remember. Example: east.country.education.girls.school.com . Thus, 1 or more alias name can be made for it, such as school.com or www.school.com. Hence , in this scenario, the east-country.education.girls.school.com is said to be the canonical hostname. DNS can obtain the canonical hostname as well as the IP address of a host.
Other service of DNS is Load Distribution.
Working of DNS and Issues Related With It :
Now you know how DNS works. When the browser wants to transforms a hostname into IP address, it invokes the DNS client . The DNS in the host sends a query into the network. After some Delay, the DNS in the user host gets a reply message within UDP datagram at port 53 that provides the correct IP address for the requested hostname. You can see that , DNS provides a simple translation service behind the scene i.e. you can also say that it acts as a black box. But in reality, this is very complicated phenomenon, that consists of thousands of DNS servers that are distributed among the globe. And also an Application Layer Protocol that regulates how the DNS servers and the requesting hosts communicate.
Now its possible that here is a single DNS server that contains all the IP addresses and the related mappings. The hosts just query the single DNS and the DNS responds directly to the requesting host. But in Today’s Internet, where millions of hosts are requesting at a time. Thus, for a single DNS to process all queries is impossible. There are certain problems associated with this centralized DNS design. These are:
i) DNS failure: If at some point of time, this single DNS server crashes or stops, then the whole Internet is dead.
ii) Far Away DNS: For example, if the single DNS is put in Australia, then all the requests from USA have to travel the whole globe to process their requests, resulting in large delays.
iii) Traffic : There are millions of users around the globe, thus making it almost impossible for the single DNS to process all the requests.
iv) Maintenance: Every day , large number of new hosts are getting added to the internet. Thus, the single DNS have to updated with these records. Hence making it very difficult to maintain.
You can now illustrate that a centralized DNS is not possible in today’s Internet. Thus, distributed DNS are implemented all over the globe to provide a better and a fast service. We will discuss the Distributed DNS in the next Post. Now coming to DNS Records and Message Format.
The DNS servers that together implements the DNS distributed database , store Resource Records(RR’s). including RR’s that provide transformation from hostname to IP address. Each DNS reply message contains one or more resource records.
A Resource Record(RR) has four fields:
(Name, Value, Type, TTL)
TTL= Time to Live
TTL determines, when the record should be removed from the cache.
The DNS servers have record in 4 types that have different fields for RR’s. These records are as follows:
a) If Type=A, the “Name” is a “hostname” and “Value is the IP address “of the hostname. For example:(shop.kung.com, 127.134.87.197,A). This a Type A example.
b) If Type=NS, then “Name” is “Domain(as kung.com)” and the “Value” is the “hostname of an authoritative server” that will know , how to obtain the IP address of the host. For Example: (kung.com, dns.kung.com, NS). This is a NS Type Records.
c) If Type=CNAME, then “Value” is a canonical hostname for the alias hostname and “Name” will provide the “Domain name” for the hostname. For Example:(kung.com, shop.cloth.metre.kung.com, CNAME). This is CNAME Type Record.
d) If Type=MX, the “Value” is the “canonical Name” of a mail server that has a Alias Name. For Example:(kung.com, mail.shop.kung.com, MX).
- MX records enables the hostnames of mail servers to have easy alias names.
- MX also enable an organisation to have same alias name for its mail server and one of its other server.
- To get the canonical name for the mail server, a DNS client would query for a MX record and to obtain the canonical name of the other server, the DNS client would query the CNAME record.
DNS Message Format :
There are two types of DNS messages. DNS query and DNS reply. The format of both these messages is same. Lets have a look at the message format of DNS.
1. The first 12 bytes or 96 bits, are called as the header section, which has 6 fields. The Identifier filed is of 16 bits, that is a number which identifies the query. A Flag contains 1 bit number, either 0 or 1. If the Message is a query, the flag is set as 0, and if the message is a reply, flag is set to 1.
2.The Next 4 fields i.e. No. of Questions, No. of Answers, No. of Authority RR’s and No. of additional Information RR’s. contains information about the Number of Occurrences of the Below Given Fields.
3. The Question Section Contains the information about the query. This Section includes two things. 1. A Name field that contains the name of the query. 2. A Type Field that contains the type of question being queried. For Example: A host Address associated with a Name of Type A.
4. In the Reply from the DNS server, the Answer Section contains the Resource Records for the name, that was queried.
5. The information about the Authoritative Servers is contained in the Authority Section.
Thank you for reading this article. We hope you enjoyed it.
This was all from us on Domain Name System(DNS). Do you have something to share with our readers ?