What is DNS, how does it work?
Before getting started you should know what is an IP address and Domain Name?
IP address, what is an IP address? (you need to know what is an IP address before getting started)
DNS,
stands for Domain Name System before starting about DNS you should know what is
a domain name and what is an IP address and DNS is a mapping of Domain name
into their respective IP and vice versa. Each and every computing Devices that
are connected to the internet has been assigned unique identification number so
that each computers are uniquely distinguished with each other over the entire
network. And this unique identification number assigned to each computer,
laptop, smartphones and other devices that are connected to the internet is
called an IP address (Internet Protocol address). IP address assigned to each
computer must be unique over the entire internet so that unique one to one
communication can be carried out. An IP address is 32 Bit address so that total
2 to the power 32 that is 4,29,49,67,296 unique addresses can be generated and
used to assign a computers connected to the internet.
Example
regarding IP address:
Let us consider a suitable example so that you
will be more clear regarding the concept of IP. Suppose you want to send a
letter to your friend from one city of country to another city using
traditional postal system then you must know the address of your friend so that
letter will be delivered successfully to your friend’s home and there must not
be another address that is similar to the address of your friend, alright?? IP
address is the same case in the field of internet, when you want to communicate
with particular computer in the internet whether it is web server or any
computers then there must be need of an IP address of destination
host(computer) so that communication is possible.
Domain Name and DNS (Domain Name System).
I know you
are thinking “I have never used an IP address and don’t know an IP address of
destination computers that I used to communicate with all the time while using
internet then how my communication is done?”. Well, the answer is You must not need to
remember an IP address of devices that you want to communicate, all you need to
know is Domain Name then rest of the work that is mapping of domain name into
its respective IP address is done by DNS (Domain Name System). You simply type www.facebook.com in the URL section of your
favorite web browser, Here Facebook is the domain name and you don’t know the
IP address of the Facebook server where your requested page(content) is
located. It is not possible to remember an IP address of each and every web server
because remembering a 32 Bit address is so hard for human being so the concept
of Domain Name is developed. When you enter the Domain Name of the web server
then it is job of DNS to find out the respective IP address of a domain that
you have entered and your requested page is displayed.
Example
regarding DNS (Domain Name System).
DNS can be
viewed as analogous to phone dictionary. We save all the phone numbers of our
friends with their name because we can’t remember the 10 Digit phone number of
all of our friends. Whenever we want to contact with some friends we simply
search their name on the contact and dial then call is made, it is not
necessary to enter phone numbers of friends once their number is saved with
their name in the contact. DNS does the same, there is the DNS server where IP
address of all the domain name is located and whenever we enter the domain name
our request is redirect to respective IP address with help of DNS.
Working of
DNS (Domain Name System)
Process of
resolving Domain Name to its respective IP is studied through seven step :
Step1: Request to local DNS Cache: The process
begin from asking your local computer to resolve a hostname such as www.facebook.com your computer first look an IP
address for facebook.com on its local cache, Local cache stores the information
recently retrieved. If the local host unable to resolve the Domain Name then
request is sent to recursive DNS server this request packet is also called as
DNS query.
Step2: Request to Recursive DNS server is
ISP’s server if the ISP’s server doesn’t contain the answer then your request
goes to root Name servers. In most of the case request ends in recursive DNS
server if the recursive DNS server has a answer.
Step3: Root name servers If the DNS server of ISP
doesn’t know the answer DNS request query is forwarded to root Name servers.
The thirteen root Name servers act as a kind of telephone switchboard for DNS.
Actually root Name server don’t know the answer but they redirect our request
to another server where to find the answer.
Step4: The
root name server first looks our request and read it from right to left and
redirect our query to Top-Level Domain
name servers (TLD). Suppose www.facebook.com is our request then root server
send the request to the TLD of .com. Top level domain means .com, .org, .us.
etc TLD has their own name servers. This server doesn’t have the information we
want but they refer us to the server that have answer.
Step5: Ask to the authoritative DNS servers: TLD
reads the second part of our request, in our request that is www.facebook.com facebook is a second part of
request reading from right to left, also called as secondary domain or specific
domain. Authoritative name server is responsible for all the information
related to specific domain. This server contain all the information related to
domain but here we want the IP address of facebook.com.
Step6: Retrieve the record to Recursive server and
local computer: recursive name
servers receive the answer that is an IP address for facbook.com and store the
answer into its cache and whenever the next request for Facebook has arrived
then there is no need to go through whole process, because answer is already
available at Recursive servers. But this cache has also the time to leave value
that is an expiration date.
And
finally your local machine receives the answer, save the IP address into its
local cache and passes the information (IP address) to the web browser from
where request has been generated. Then browser set up a connection with
Facebook web server and receive the requested page & displays to the
monitor.
This is
what happens when you request a particular website on the internet but The
entire process takes only few milliseconds to complete.