It works like it has its own network and if one Domain Name Server doesn’t resolve the domain name to IP Address; it will pass it on to the other domain name server unless it gets resolved to a particular IP Address. (Remember the error? “The requested URL could not be retrieved”). It is something like a phone directory for the internet!
With the passage of time number of hosts increased exponentially and Local organizations were administering their own names and addresses, but had to wait for the NIC to change HOSTS.TXT to make changes visible to the Internet at large. Organizations also wanted some local structure on the name space. IT created a need for general purpose for this host name to IP Address mapping.
So DNS came into the picture in 1982 and was proposed & first implemented by Jon Postel, Paul Mockapetris.
DNS in minimal depth
- What is Domain Name
The name www.aliencoders.org actually has three parts:
The host name ("www")
The domain name ("aliencoders")
The top-level domain name ("com")
Domain names within the ".com" domain are managed by the registrar called VeriSign. VeriSign also manages ".net" domain names. Other registrars (like RegistryPro, NeuLevel and Public Interest Registry) manage the other domains (like .pro, .biz and .org). For more details on authorized domain names, you can visit this website: http://www.icann.org/registrar-reports/accredited-list.html
VeriSign creates the top-level domain names and guarantees that all names within a top-level domain are unique. VeriSign also maintains contact information for each site and runs the "whois" database.
The host name is created by the company hosting the domain. "www" is a very common host name, but many places now either omit it or replace it with a different host name that indicates a specific area of the site. For example, in encarta.msn.com, the domain name for Microsoft's Encarta encyclopedia, "encarta" is designated as the host name instead of "www".
- What is the work of Registrar (Domain Name Registrar)?
In the same way, a Domain Name Registrar is a service provided by different valid registrars through whom you can register your domain name which will be unique and will be owned by you only.
Domain name registrars are authorized by the Internet Corporation for Assigned Names and Numbers (ICANN). ICANN is a private (non-government), non-profit corporation that has been given the responsibility of allocating IP addresses and managing the Domain Name System.
- How DNS works? (With Image)
DNS has three major components (structure with Image)
- Domain name space and space records
The domain name of a node is the list of the labels on the path from the node to the root of the tree. By convention, the labels that compose a domain name are printed or read left to right, from the most specific (lowest, farthest from the root) to the least specific (highest, closest to the root).
Internally, programs that manipulate domain names should represent them as sequences of labels, where each label is a length octet followed by an octet string. Because all domain names end at the root, which has a null string for a label, these internal representations can use a length byte of zero to terminate a domain name.
- Name servers and its types
A name server is said to be an AUTHORITY for these parts of the name space. Authoritative information is organized into units called ZONEs, and these zones can be automatically distributed to the name servers which provide redundant service for the data in a zone. Zone records will be stored in a zone file which will be updated all across the domain servers.
It is of mainly two types (third is a kind of combination the above two) :
- Authoritative Name Server
An authoritative name server can either be a master server or a slave server. A master server is a server that stores the original (master) copies of all zone records. A slave server uses an automatic updating mechanism of the DNS protocol in communication with its master to maintain an identical copy of the master records.
Every DNS zone must be assigned a set of authoritative name servers that are installed in NS records in the parent zone. Ex: www.aliencoders.org (Fully Qualified Domain Name or FQDN) is an example of an authoritative name server which serves root name servers as www->aliencoders->com->root tree structure and from com it is served as com->root
- Recursive Name Servers
- Caching Name Servers
A DNS query may be either a non-recursive query or a recursive query:
- A non-recursive query is one in which the DNS server provides a record for a domain for which it is authoritative itself, or it provides a partial result without querying other servers.
- A recursive query is one for which the DNS server will fully answer the query (or give an error) by querying other name servers as needed. DNS servers are not required to support recursive queries.
Overview of DNS mechanism (Image source: bytemark.co.uk)
- How DNS message is transmitted?
The Internet supports name server access using TCP [RFC-793] on server port 53 (decimal) as well as datagram access using UDP [RFC-768] on UDP port 53 (decimal).
Messages carried by UDP are restricted to 512 bytes (not counting the IP or UDP headers) and is not acceptable for zone transfers, but is the recommended method for standard queries in the Internet.
- What happens when one registers a new domain name?
- Host (A) — This is the basic mapping of IP address to host name, the essential component for any domain name.
- Canonical Name (CNAME) — This is an alias for your domain. Anyone accessing that alias will be automatically directed to the server indicated in the A record.
- Mail Exchanger (MX) — This maps e-mail traffic to a specific server. It could indicate another host name or an IP address. For example, people who use Google for the e-mail for their domain will create an MX record that points to ghs.google.com.
- Name Server (NS) — This contains the name server information for the zone. If you configure this, your server will let other DNS servers know that yours is the ultimate authority (SOA) for your domain when caching lookup information on your domain from other DNS servers around the world.
- Start of Authority (SOA) — This is one larger record at the beginning of every zone file with the primary name server for the zone and some other information. If your registrar or hosting company is running your DNS server, you won't need to manage this. If you're managing your own DNS, Microsoft's support information has a helpful article on the structure of a DNS SOA Record.
- Text (TXT) —it is an informational record which is used for additional information about a host or for technical information to servers.
- Service Records (SRV) — SRV records are resource records used to identify computers hosting specific services.
- AAAA — AAAA records store a 128-bit Internet Protocol version 6 (IPv6) address that does not fit the standard A record format. For example, 2007:0db6:85a3:0000:0000:6a2e:0371:7234 is a valid 128-bit/IPv6 address.
- What about the DNS Security?
Other well-known vulnerabilities are DNS Cache poisoning (DNS Spoofing) and DNS Hijacking (DNS Redirection)
This was just the overview of what DNS is and how it works. If you are interested in detailed explanation rfc 1034 is the right place, especially for networking people.
How Stuff Works: http://www.howstuffworks.com/dns.htm
Domain Name- Concepts and Facilities: rfc 1034 and
Domain Names – Implementation and Specifications: rfc 1035