Saturday 24 March 2012

DNS Resolution Process

Let's check how a Domain Name Service works when we entering a name into a client like a browser or a mail client.

1. When a user type a host name (www.ctechz.co.in) in a browser the application then try to find the IP address associated with that domain name. The process associated with it is either called a reverse lookup or a forward lookup.

Checking of IP address associated with a domain name is
known as forward lookup and also the checking of domain name associated with an IP address is called reverse lookup.

There are 13 root name servers on the internet which provides the necessary name server details.

Each country has a name server and each organization has a name server too. Each NS only has information about machines in its own domain as well as information about other name servers. The root NS only has information on the ip address of the name servers of .com, .edu etc (top level domains).

* .in NS only has information on the IP address of the name servers of .org.in, .ac.in, .co.in etc

* .co.in NS only has information on the name servers of all indian companies or which hosted in india.

* .ctechz.co.in NS only has information on the machines at ctechz systems like www.ctechz.ci.in etc...

The Name Resolution Process

Here we can take an example with domain www.ctechz.co.in, the following take place to resolve this name into an IP address. This procedure is called hostname resolution and the algorithm performs this operation is called the resolver.

2.  The application checks local database on the local machine first. If it can get an answer directly from them it proceeds no further.

3. otherwise request will sent to NS to find the IP address associated with www.ctechz.ci.in.

4. NS determines whether that IP has been recently looked up or not. If it is there, no need to ask further. Since the result would be stored in a local cache.

5. NS checks whether the domain is local, ie, if a computer that has a direct information about. In  this case this would only be true if the NS were www.ctechz.co.in's very own NS.

6. NS strips out the TLD (top level domain) .in and it queries a root NS, asking what NS is responsible for .in. It will return an answer say a NS of IP 127.168.2.33. Depend on the answer NS will query authoritative server for IP address.

7. NS strips out the next highest domain .co.in and it queries to 127.168.2.33 asking what NS is responsible for .co.in, it will return an answer say a NS of IP 192.168.55.67.

8. NS strips out next highest domain .ctechz.co.in and it queries 192.168.55.67 asking what NS is responsible for ctechz.co.in, it will return an answer say a NS of IP 196.28.120.5

9. NS queries 196.28.120.5 asking for IP address of  www.ctechz.co.in and the answer will be 160.120.170.3

10. NS returns result to the application.

11. NS stores each of these result in local cache with an expiration date, to avoid having to look up a second time.

Configuring local Machine

Some configuration file in local machines are the following,

  /etc/host.conf
 /etc/hosts
 /etc/resolv.conf

1. Application checks /etc/host.conf which has the line order hosts,bind
 specify it should first check the local database file /etc/hosts and then query the NS specified in /etc/resolv.conf(bind)

The file /etc/hosts contain plain list of IP address and names. If an application can get an answer directly from /etc/hosts it proceeds no further.

2. The application checks in the file /etc/resolv.conf for a line 
nameserver <nameserver>

3. The application sends to the NS a query with the hostname [ checks local db first ]  then proceeds with the hierarchical queries.

No comments:

Post a Comment