Sei sulla pagina 1di 27

Search Articles ...

Search

HOME PAGE ABOUT US CONTACT US ARCHIVE ARCHIVES SECURITY NOTES TECHNICAL NEWS

NETWORKING

Home Archives how does DNS server work how does DNS server work

how does DNS server work

Submitted by Sarath Pillai on Mon, 10/22/2012 - 20:48

introduction and history of dns name


servers

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
Hi all ...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. Even
for a handful of hosts in a local network, it will be very difficult to memorize all the numerical address of each
of them, so forget about memorizing numerical addresses of more than 400 million hosts in the internet.

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.

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
During the mid 1970's 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.

This main problem of converting names to numbers in networking is as old as computer networking itself.

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.

a centralized server for the name server was much better than /etc/hosts file solution. because now with a
central server dedicated for name to address mapping, the machines in the network only needed to know the
numerical address of the name server, and the name server will return the numerical address of a name,
whenever asked by the clients.

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.

But there were some drawbacks of a central name server also, like what if the central name server is not
available? Hence came the idea of multiple name servers, in the network, one acted like a master or primary,
and the other a slave or secondary. If master is not available then the secondary name server of the slave
name server, is queried for the answer.

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
There were some main drawbacks of even this kind of an implementation (primary and secondary name
servers). they are as follows.

1.As the names in the network goes on increasing, it becomes too much difficult for a name server to retrieve
an information from millions of entries. So we needed a method to organize the names.

2.Imagine a single name server getting lot and lots of queries per second, in such cases the load on the
name server increases. So we need to find a method to spread the load.

3.We needed a mechanism to separate the administration of the entries in the name server, as many
different administrators used to add entires.

The Domain Name System of the Internet.

the complete DNS functionality is explained in the following RFC's

RFC 1034

RFC 1035

The domain name system of the internet works in a inverted tree structure.At the top of the tree is the root
name server(don't worry, i will explain whats a root 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 seperated by
dots.

Understanding the above explained thing which is underlined is very much important in understanding the
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
concept of DNS.

The root server is represented by a .(a dot).

TLD's are split into two types as follows.

Generic Top Level Domains(gTLD's) are TLD's like .com,.net,.org,.edu etc.

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
Country Code Top Level Domains are domains such as .in,.us,.uk etc.

Now when we call www.slashroot.in a domain name, this domain name is a combination of
gTLD,SLD(Secondry Level Domain) and the host name.We will come back to this in some time.

When we normally call a domain like google.com its the combination of TLD,SLD.

Each and every node in this Domain Name system is assigned to an authority or organization for its
administration. And that organization resposible for a particular node is authoritative for that node.The term
authoritative will be used many times in DNS system.

Now the authority of the .(root name server) which is at the top of the heirarchy lies with an organization
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
named ICANN(Internet Corporation for Assigned Names And Numbers.).

gTLD's like (.com,.net) and others are also administered by ICANN and are also delegated to ICANN
accredited registrars. ccTLD's are accredited to different countries for administration by ICANN.

Delegation in DNS is an important concept...I will keep another dedicated post only for delegation.

It is very much important to understand the fact that, the left most part (www) in any address, like for example
www.slashroot.in, is the hostname. WWW is used by websites only by convention, there is no rule to use www
for a website. A web site can also be named xyz.example.com.

what happens when I type www.example.com in the address bar of the browser?

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.

a.root-servers.net.
b.root-servers.net.
c.root-servers.net.
d.root-servers.net.
e.root-servers.net.
f.root-servers.net.
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
g.root-servers.net.
h.root-servers.net.
i.root-servers.net.
j.root-servers.net.
k.root-servers.net.
l.root-servers.net.
m.root-servers.net.

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.

If it was www.example.net then root server will give, .net TLD servers refferal.

Step5: Now One of the TLD servers of .com will give us the referral to the DNS server resposible for
example.com domain.
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
Step6: the dns server for example.com domain will now give the client the ip address of www host(www is
the host name.)

Now lets practically have a look at how this process works.

[root@myvm1 ~]# dig +trace www.google.com

; <<>> DiG 9.3.4-P1 <<>> +trace www.google.com


;; glob al options: printcmd
. 5 IN NS a.root-servers.net.
. 5 IN NS b .root-servers.net.
. 5 IN NS c.root-servers.net.
. 5 IN NS d.root-servers.net.
. 5 IN NS e.root-servers.net.
. 5 IN NS f.root-servers.net.
. 5 IN NS g.root-servers.net.
. 5 IN NS h.root-servers.net.
. 5 IN NS i.root-servers.net.
. 5 IN NS j.root-servers.net.
. 5 IN NS k.root-servers.net.
. 5 IN NS l.root-servers.net.
. 5 IN NS m.root-servers.net.
;; Received 228 b ytes from 192.168.159.2#53(192.168.159.2) in 49 ms

com. 172800 IN NS a.gtld-servers.net.


com. 172800 IN NS b .gtld-servers.net.
com. 172800 IN NS c.gtld-servers.net.
com. 172800 IN NS d.gtld-servers.net.
com. 172800 IN NS e.gtld-servers.net.
com. 172800 IN NS f.gtld-servers.net.
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
com. 172800 IN NS g.gtld-servers.net.
com. 172800 IN NS h.gtld-servers.net.
com. 172800 IN NS i.gtld-servers.net.
com. 172800 IN NS j.gtld-servers.net.
com. 172800 IN NS k.gtld-servers.net.
com. 172800 IN NS l.gtld-servers.net.
com. 172800 IN NS m.gtld-servers.net.
;; Received 504 b ytes from 198.41.0.4#53(a.root-servers.net) in 153 ms

google.com. 172800 IN NS ns2.google.com.


google.com. 172800 IN NS ns1.google.com.
google.com. 172800 IN NS ns3.google.com.
google.com. 172800 IN NS ns4.google.com.
;; Received 168 b ytes from 192.33.14.30#53(b .gtld-servers.net) in 12 ms

www.google.com. 300 IN A 74.125.236.48


www.google.com. 300 IN A 74.125.236.50
www.google.com. 300 IN A 74.125.236.51
www.google.com. 300 IN A 74.125.236.49
www.google.com. 300 IN A 74.125.236.52
;; Received 112 b ytes from 216.239.34.10#53(ns2.google.com) in 108 ms

Now you can clearly see from the dig with trace output that, the request first went to root servers. a.root-
servers.net replied me with the addresses of all .com gtld servers, and b.gtld-servers.net gave me the name
servers for google.com and finally ns2.google.com replied me with the ip address of www.google.com

Hope you guys enjoyed the post...!!

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
Rate this article:
Average: 4.9 (719 votes)

21 Comments

Add a comment...

Cag Hal
Very nice writeup.
Like Reply 2 Feb 14, 2013 9:57am

Sankar PN Technical Services Specialist at IBM India Pvt Ltd


Greate job
Like Reply Sep 18, 2013 9:15am

Amir Reza
tanx for this useful post
Like Reply Oct 3, 2013 10:44pm

Om Precious Head Cashier at Punjab National Bank


finally got the meaning of . (dot).
Like Reply 1 Dec 18, 2013 10:38pm

Sandeep Khot Vtu


Nice one bro...
Like Reply Feb 20, 2014 7:38pm

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
Glenn Huang
Thank you VERY much. Well done.
Like Reply Feb 21, 2014 2:21pm

Roni KB Works at Citrus Informatics


Now got the meaning of . (dot). Thanks
Like Reply Jun 26, 2014 5:11am

Akhil Mathur Shaheed Bhagat Singh College


Very nice write up. Thanks!
Like Reply May 7, 2015 10:41pm

Raji Ramakrishnan Dhanalakshmi College of Engineering


thanks its wonderful post
Like Reply Jul 3, 2015 9:52am

Haider Ali PUCIT - Punjab University College of Information Technology


Very nice. You explained it very well.
Like Reply Dec 30, 2015 4:28am

Load 10 more comments

Facebook Comments Plugin

Add new comment

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
Comments

oops
Permalink Submitted by sajan samuel on Wed, 10/01/2014 - 10:34

tnks slash root

reply

Good job
Permalink Submitted by Sonu on Wed, 01/14/2015 - 11:07

Very well described...excellent job

reply

Linux Admin at CGI


Permalink Submitted by Narendra Yadav on Mon, 01/19/2015 - 00:56

Superb
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
reply

why resolvers needed?


Permalink Submitted by yshu on Tue, 02/03/2015 - 22:21

If dns package has the ip addresses of root name servers, then what exactly is the use of resolv.conf ?
Can they directly contact the root level name servers for dns resolution ?? sorry for being stupid..

btw.. awesome explanation...

reply

Use of resolve.conf
Permalink Submitted by Ajith PG on Sat, 07/09/2016 - 19:04

Hello,

The resolve.conf file is used to specify your own name servers. You may have your own server or you
can use public name servers like 4.2.2.2/8.8.8.8 etc. You need any of these servers to contact the root
name servers. Without the name servers your system won't be knowing where to look for a DNS
resolution. That's the use of resolve.conf.

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
reply

Sys Admin.
Permalink Submitted by Arnoldjacko on Thu, 02/05/2015 - 20:16

Great help to understand DNS.

reply

How DNS works


Permalink Submitted by Khan on Thu, 05/21/2015 - 11:52

Hi dear,

It was superb explanation.

Is there any another URL of yours for DNS records, so please let me know.

My email id is Nkhan0608@hotmail.com

reply

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
Thanks
Permalink Submitted by Toji K Dominic on Wed, 07/22/2015 - 09:31

Thanks for the wonderful post.


Simple ,clean post.

reply

a mistake in the post


Permalink Submitted by Moein on Fri, 11/06/2015 - 16:10

Now when we call www.slashroot.in a domain name, this domain name is a combination of
gTLD,SLD(Secondry Level Domain) and the host name.We will come back to this in some time.

gTLD =>ccTLD

-----
thanks for your post :)

reply

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
dig output shows google.com where as you refererred example.com
Permalink Submitted by Muthukumar on Sun, 12/13/2015 - 18:27

Thanks it is wonderful and really meant lot for me.

one thing I just want to notify you so that you can update this fourms

# dig output shows reverse lookup zone details of google.com whereas you mentioned example.com in all
explanation.

Thanks

reply

dns server working


Permalink Submitted by prathyusha on Thu, 07/28/2016 - 10:33

nice explanation. Thanks for this post.

reply

HOW DOES DNS SERVER WORKS


open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
Permalink Submitted by lingamoorthy.dasari on Mon, 10/03/2016 - 13:32

Excellent explanation.

Thanks alot for your organization staff members and participants.

reply

Excellent explanation
Permalink Submitted by Vijay Sakpal on Fri, 10/14/2016 - 13:25

Excellent explanation

reply

Really Nice. It helps me to


Permalink Submitted by Anonymous on Mon, 12/12/2016 - 20:05

Really Nice. It helps me to understand better.

reply

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
Very Good
Permalink Submitted by Anonymous on Wed, 02/01/2017 - 10:10

Very good explanation. Thanks.

reply

You said TLD are split into two types - THIS IS WRONG
Permalink Submitted by gary on Fri, 03/17/2017 - 11:38

hi,
please read the following from Top level domain article of wikipedia..

TLD is not split into 2 types. gtld and cctld are groups of top level domains.

As of 2015, IANA distinguishes the following groups of top-level domains:[13]

infrastructure top-level domain (ARPA): This group consists of one domain, the Address and Routing
Parameter Area. It is managed by IANA on behalf of the Internet Engineering Task Force for various
purposes specified in the Request for Comments publications.
generic top-level domains (gTLD): Top-level domains with three or more characters
restricted generic top-level domains (grTLD): These domains are managed under official ICANN accredited
registrars.

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
sponsored top-level domains (sTLD): These domains are proposed and sponsored by private agencies or
organizations that establish and enforce rules restricting the eligibility to use the TLD. Use is based on
community theme concepts; these domains are managed under official ICANN accredited registrars.
country-code top-level domains (ccTLD): Two-letter domains established for countries or territories. With
some historical exceptions, the code for any territory is the same as its two-letter ISO 3166 code.
internationalized country code top-level domains (IDN ccTLD): ccTLDs in non-Latin character sets (e.g.,
Arabic, Cyrillic, Hebrew, or Chinese).
test top-level domains (tTLD): These domains were installed under .test for testing purposes in the IDN
development process; these domains are not present in the root zone

reply

Add new comment

Your name

Subject

Comment *

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
No HTML tags allow ed. More information about text formats
Web page addresses and e-mail addresses turn into links automatically.
Lines and paragraphs break automatically.

Word verification *

(verify using audio)

Type the charac ters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.

Save Preview

Searc h Artic les ... Search

Subscribe Our Mailing List


open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
* indicates required
Email Address

*
First Name

Last Name

Subscribe

Today's Most Popular

IPERF: How to test network


Speed,Performance,Bandwidth
Arc hives - 15 comment(s)

What is a DNS ZONE file: A Complete Tutorial on


zone file and its contents
Arc hives - 4 c omment(s)

Examples of using SAR command for system


open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
monitoring in Linux
Arc hives - 25 comment(s)

SAN vs NAS - Difference between a Storage Area


Network and Network Attached Storage
Arc hives - 49 comment(s)

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
Most Commented Top Rated Articles

How Does Traceroute Work and Example's of using EIGRP (Enhanced Interior Gateway Routing Protocol)
traceroute command
Networking - 69 comment(s)
Average: 5 (5 votes)

SAN vs NAS - Difference between a Storage Area


Network and Network Attached Storage Introduction to git version control system

Arc hives - 49 comment(s)

Average: 5 (3 votes)
difference between iterative and recursive dns query
Arc hives - 42 comment(s) Netstat command examples and its usage

Linux Booting Process: A step by step tutorial for


Average: 5 (8 votes)
understanding Linux boot sequence
Arc hives - 37 comment(s)

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
Arc hives - 37 comment(s)
how to install and configure kerberos server

Average: 5 (2 votes)

LAMP configuration on rhel5

Average: 5 (14 votes)

examples of using basic linux regular expressions

Average: 5 (2 votes)

Dockerfile Tutorial - Building Docker Images for


Containers

Average: 5 (9 votes)

How to configure software raid10 in Linux

Average: 5 (10 votes)

Jump back to navigation

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
Get in touch with The Authors Follow Us
Sarath Pillai
Subscribe to our RSS Feed

Ph: +917303074400
Follow us on Twitter
Email: sarath@slashroot.in
Be a fan on Facebook

Our News Letter


Satish Tiw ary

Ph: +919509452488 * indicates required


Email Address
Email: satish@slashroot.in

*
Subscribe

Recent Posts Last Viewed

Difference Between Segments, Packets and Frames inode and its structure in linux

Netw orking - 3 days 7 hours ago Archives - last view 16 sec ago

How is TCP & UDP Checksum Calculated? What is a DNS ZONE file: A Complete Tutorial on
zone file and its contents
Netw orking - 4 days 9 hours ago
Archives - last view 38 sec ago

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
How Does UDP Work ?
Encrypting a Linux Partition Using LUKS
Netw orking - 5 days 10 hours ago
Security Notes - last view 42 sec ago

Understanding Object Oriented Programming in


Python The Advanced Guide to LVM-Logical Volume
Management on Linux: PART 1
Archives - 1 week 1 day ago
Archives - last view 1 min 3 sec ago

Copyright Slashroot.in.All rights reserved.Privacy Policy|Term s Of Service|Sitem ap

open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com

Potrebbero piacerti anche