There are times when we need to lookup a phone number for a person or address of a business, then we look it up in the directory or yellow pages. Similarly when computer wants to find an address of another computer then it looks it up via Domain name system. Domain name system is like a directory for computers using which it can locate other computers on the network.
One might ask when does a computer need to locate another computer. The answer is whenever we need to send or get any message from another system e.g. when you enter the name of a web-site in your web-browser such as www.computergenome.com then the web browser will need to find the address of web server of computergenome web site, or when you send an email to firstname.lastname@example.org then the email client would need to find the address of gmail email server. The addresses "www.computergenome.com" or "email@example.com" might appear as valid addresses but computers need some other form of addresses e.g. IPv4 or IPv6, to locate each other.
Computers use numerical addresses for locating each other, such as web server for www.computergenome.com might have an IPv4 address ????. Compyters prefer to have addresses in formas of number instead of long strings because it is more efficient for computers to process. Addresses such as IPv4 or IPv6 are fixed length addresses, which is easy and fatser for computers to process. Computers can derive hierarchy from the numerical addresses which would be little more difficult or atleast more confusing to implement otherwise.
In computer lingo, the string such as "www.computergenome.com" is known as a domain, converting the domain name to IP address is known as resolving the domain name. Domain name service is the process which aids in resolving an domain anem to its address (which may be an IPv4 o IPv6.)
A common domain name such as "www.computergenome.com" comprises of a different sub domains. A domain like ths would be resolved in parts, one step at a time. A client would break the domain name such as "www.computergenome.com" into parts starting from the right end. A client would first resolve .com (which is the top level domain,) which would take the client to a server. Then using that server, the client would try to resolve the domain computergenome.com. This would take the client to the server where the site is hosted. Using this server, a client will try to resolve the domain www.computergenome.com.
A domain name server is a server which is capable of receiving a DNS request and returning the information related to the domain. However, a single domain name server would not be able to handle request for all the computers on the internet. So there are several domain name servers arranged in a hierarchy which can be used to resolve a domain name. A domain name server can be configured to a small set of domains called its "local zone". All the requests for a domain which does not belong to that's local zone would be referred to other servers in the hierarchy.
For example there might be DNS servers that contain the domain information for domains ending in .com only, then there are servers that contain information for domains ending in .org domains only. Then the organisations might have their own DNS servers that contain information for their own domain. e.g. "ACME" oganiszation might have an internal DNS server which contains information for traps.acme.com domain, elevator.acme.com domain etc. So using this way the information can be distributed among the different DNS servers.It is not unsual for internet service provider to provide their own domain name server as well . For instance if you have taken an internet connection from an ISP such as comcast, then comcat would provide your computer with an address for the DNS server. That DNS server in most cases would be maintained by comcast itself.
In the hierarchy of domain name service, root servers sit at the top. Root servers contain the list of IP addresses for the servers which are manging the top level domains such as .com, .org, .net etc. The root servers cannot resolve a web-site such as "www.computergenome.com" but can tell which servers contain information for websites ending in .com and then these servers can be approached for reslving www.computergenome.com. Currently there are 13 root servers in the world and their addresses are well known. So other DNS servers already know about them without needing to ask somebody about their location.
A domain name server might be assigned couple of domains and will be configured with a information for these domains. This server is said to be an authoratative server for these domains. If this server gets a request for a domain which is configured at this server, then its reply is said to be authoritative otherwise it can query another server and send the response which is called as non-authoratitive response.Now an server can be configured to contain an IP address of an domain or it can contain the IP address of authoritative server for an domain e.g. a server can be configured to contain the IP address of www.computergenome.com. So when it receives a query for resolving www.computergenome.com, it can reply with the IP address. In this case this server becomes the authoritative server for www.computergenome.com. However, the server can be configured to contain the IP address of authoritative server for www.computergenome.com. So when a server receives a query for www.computergenome.com it can reply with the IP address of server which contains the IP address for www.computergenome.com.
Let us take an example of how the address "en.wikipedia.org" gets resolved.
When a DNS server makes a query to another server to resolve a domain name, it can cache the response as well. In each response there is TTL (time to live) value specified as well, which means that the particular response is valid for some time. TTL value is specified in seconds and the DNS server can cache a response for that without needing to ask another server again.
It is possible to make a DNS server as caching server only, which means that it is not an authoratitive server for any domain. This can be done to optimize web traffic. Consider a DNS server of an ISP such as comcast. When the customers of comcast connect to internet they are provided the DNS IP address of the server maintained by comcast. Now this server can be caching only server which stores the responses made by the requests of every user in its case. When a user makes a request to resolve "www.computergenome.com" for the first time, comcast's DNS server will have to ask other DNS server to resolve the domain. But it can cache/store this response. So when any other user requests to resolve the same domain comcast's server does not ask another server for resolving the domain, it can simply look up the IP address from its cache and respond.
When a DNS client needs to resolve an IP address it would generally request the operating system to make requests. The operating system will generally contain alocal resolver logic which would try to resolve the domain name locally before requesting any DNS server.
A DNS client needs to be configured with a set of DNS server so that it can initiate a DNS request when needed. This information is generally configured into the system manually (either by administrator or by the user himself) or by using DHCP. On most of the linux systems the file
A recursive address resolution means resolving the complete domain at a time. When the DNS client sends a request to a DNS server for resolving www.computergenome.com, then it will return the response to the client if it is the authoratitive server for that domain or if it has cached the DNS response from a previous request. However, if the DNS server finds that it needs to make a DNS request to another server then it has two options:
In iterative address resolution, the client or the local resolver is given the address of authoratitive servers for a subdomain which needs to be queried again.e.g. The clinet/local resolver trying to resolve "www.computergenome.com" would get the adress for authoratative server for .com domain. When authoratitive server for .com domain is queried, address for authoratitive server for computergenome.com is obtained. When the authoratitive server for computergenome.com is queried, address for www.computergenome.com is received.
The address resolution in iterative address resolution method might go like this:
In recursive address resoultion the DNS server takes upon itself the responsibility of resolving the address of an domain name. However, this behaviour needs to be enabled at the server, otherwise it will default to iterative behaviour.
In recursive address resoultion, an domain name such as "www.computergenome.com" might be resolved like this.