in this post we will be discussing the most important and inevitable resource in the world of internet, which each and everyone of us uses knowingly or unknowingly.
Each and every machine in a network is identified by a numerical address. This address can be used by other machines in the network to communicate with each other. But without a relevant name associated with that numerical address, it will be very difficult to memorize the numerical address of all the machines in the network.
initially the concept of host file was born to solve the problem, each and every machine in the network used to have a host file, /etc/hosts where the name to address mapping was done.. But with the passage of time,problems like the below emerged.
1.each and every machine needed to update the the newly added entries themselves.
2.there was no kind of notification available for clients to know a new entry has been added.
3.by the passage of time, a single file became large and very large, making it difficult to handle.
Then the concept of name servers came into place. the basic idea behind this name servers was that, people find it easy to remember names rather than numbers, especially when that name describes some attributes of a resource.
When a name server is present in a network the machines in the network only needed to know, the numerical address of the name server and the name of the destination machine or a website. With these information in hand the machines in the network can ask the name server in the network for the numerical address (IP address) of the destination.
the major advantage of having a central name server was that the numerical address or the IP address of the server, can be changed without the clients being aware of the change. In such situations the name server just needed to be updated or modified with the new IP address.
The Domain Name System of the Internet
The domain name system of the internet works in a inverted tree structure.At the top of the tree is the root name server. The root server is followed by TLD’s or Top Level Domains,and then TLD’s are followed by SLD’s or Second Level Domains. All of these are separated by dots.
The root server is represented by a .(a dot).
the root name server(.) is the most important resource in the name server heirarchy. when any name server is asked for an information which it does not have, the first thing that name server does is asking one of the (.)root name server.
there are 13 root name servers as follows.
Now the ip address of all the root servers mentioned above are known to all the DNS software packages, by default. Which means all the DNS servers can reach these root servers without any other DNS server.
Step1: the client types www.example.com in his browser
Step2: the operating system looks at /etc/host file,first for the ip address of www.example.com(this can be changed from /etc/nsswitch), then looks /etc/resolv.conf for the DNS server IP for that machine
Step3: the dns server will search its database for the name www.example.com, if it finds it will give that back, if not it will query the root server(.) for the information.
Step4: root server will return a referral to the .com TLD name server(these TLD name servers knows the address of name servers of all SLD’s).In our case we searched for www.example.com so root server will give us referral to .com TLD servers.
Step5: Now One of the TLD servers of .com will give us the referral to the DNS server resposible for example.com domain.
Step6: the dns server for example.com domain will now give the client the ip address of www host(www is the host name.)
Hope you will get some basic Idea of how DNS works 🙂