A Domain Name System or DNS is a global and highly distributed Network Service that resolves strings of letters into IP addresses. Imagine what could happen, if you have to remember four octets or 32 bit IP Address for every website you visit. This is not the thing human brain is typically good at. Rather human brain is much better at remembering words. This is the reason the DNS comes into play. In this article we’ll discuss about Name Resolution Steps of DNS. But before that lets understand the basic concept of DNS.
DNS – Domain Name System | The Basic Concept
As we’ve said before that DNS is a global and highly distributed Network Service that resolves string of letter into IP address. For example, if we want to check google to search anything, we type google’s Domain_Name: www.google.com on the browser’s address_bar, rather than writing it’s IP Address 220.127.116.11. Because remembering the Domain Name is much easier than remembering the IP Address for this site.
Domain Name is the term we use so that we can remember the site more easily. For a lot of different reasons IP Address(es) of a specific Domain Name can vary. For example google.com has moved their web server to new data center, etc. So by using Domain Name it also becomes easy for an organization to change their IP Address without affecting end user experience.
The reason behind a Domain Name to have different IP Addresses is that the further you have to route data, the slower things will become. Therefore a global web company like Google distributes their web servers across different data center around the globe. This way DNS also helps provide this functionality. Because of its global structure, DNS lets organizations decide, if a user is in a region, DNS will resolve the Domain Name into the IP address of the data center nearest to the region.
Name Resolution Steps | A highly distributed Network Service
So far we have discussed that DNS is a system that converts Domain Names into IP addresses. That Means it’s job is to resolve human understandable thing to machine understandable thing. The process DNS uses to turn a domain name into an ip address refers to as ‘Name Resolution‘. Now we will see how exactly this process works.
The first thing that is important to know that DNS server is one of the thing that is specifically need to configure at a node on a network. For a computer connecting on a modern network, it is important to have certain number of things configured to operate in an expected way. Those are IP Address, Subnet Mask, Gateway, and the DNS Server. It is also worth mentioning that a computer on a network works just fine without configuring DNS Server. But in that case a user must need to type the specific IP Address for the website he wants to visit.
DNS Servers are primarily five types:
- The Caching Name Servers
- Recursive Name Servers
- Root Name Servers
- TLD Name Servers
- Authoritative Name Servers
But it is important to note that any given DNS server can fulfill many of these roles at once. An ISP or a local network generally provides the caching and recursive name servers. The purpose of these servers is to store known domain name lookups for a certain amount of time.
Steps Of Full Name Resolution Process | Steps of a Fully Qualified Resolution of a Domain Name
THere are lots of steps in order to perform a fully qualified resolution of a domain name. So to prevent these steps to happen repeatedly for every single TCP Connection, an ISP generally will have a Caching Name Server available.
Most Caching Name Servers are also Recursive Name Servers. The Recursive Name Servers mainly perform Full DNS Resolution Requests. Therefore in most cases, a local name server will perform the duties of both. But there is also possibility that a name server is either just a Caching or just a Recursive.
How a Recursive Name Server Performs the job of Caching Name Server.
Suppose two PCs on a same Network configured with same Name Server. Let PC1 asks the Name Server for the IP of google.com. Then the name server performs a fully recursive resolution to discover the correct IP for google.com. THe name server then deliver the IP to PC1 and also stores locally in a Cache. After some time PC2 also asks the same local Name Server for the IP address of google.com. As the local Name Server stores the IP address of that particular domain after performing full qualified Resolution. Therefore it delivers to PC2 immediately from its cache without performing fully recursive resolution again. This way a Name Server can perform the job of both Recursive and Caching.
All domain Names in global DNS system have TTL value. This is a value in seconds. An owner of the domain configures the TTL that how long a name server can cache an entry before it should discard it and perform a full resolution again. Now we will see how recursive name server performs a fully qualified resolution or full recursive resolution of a domain name .
Fully Qualified/Recursive Resolution, Step-1: Contacting a Root Name Server
The fully recursive resolution always begins with contacting root name server. The root is just the dot ‘.’ at end of a fully qualified domain. Such as www.google.com. the dot at the end of the domain name indicates a query need to be performed at the root name server. We generally don’t type the dot, but behind the scene the browser exactly do that.
There are 13 total root name servers operated by 12 independent organizations. In early days of Internet most of the operators was in the united States. But now there are over 750 instances (hosts) of these 13 root name servers all over the world. The hosts of these root servers unable to manage or administer these root servers. The only person in the world that can modify, login or control, or administer a root server is those operators.
The DNS Root zone contains the IP information over 15 hundred generic TLD as that where to find the top level domain server for .com, .net, .org, etc. It also contains the country code top level domain such as .de for Germany, or .cn for China etc, as well as the IDs of internationalized domain name.
So the root_name servers are responsible for directing queries towards the appropriate TLD name server. These Root Servers mostly distributed across the globe via anycast. Using anycast a computer can send a datagram to a specific IP, but could see it routed to one of many different actual destinations depending on a few factors. So there are not only 13 physical root server anymore. Rather there are 13 authorities that provide root name lookups as a service. The Root server will respond to a DNS lookup with the TLD name server that should be queried.
Querying on TLD name Server
TLD stands for Top Level Domain. It represents the top of the hierarchical DNS Name resolution System. A TLD also is the last part of a Domain Name (i.e. .com, .org). For each TLD in the existence there is a TLD Name server. It’s most likely a global distribution of anycast accessible servers responsible for each TLD.
The Recursive Name Server then queried with TLD name server. The TLD server will respond again with a redirect that tells the Recursive_Server to perform a name lookup with Authoritative Name server.
Performing a Lookup with the Authoritative Name Server
Authoritative name servers are responsible for the last two parts of any domain name. This is the resolution at which a single organization may be responsible for DNS lookups. Finally the DNS lookup could be redirected at the authoritative server. The Authoritative server then will provide the actual IP of the server in question.
So name lookup follows this strict hierarchy which is very important for the stability of the internet. Because any computer will blindly send traffic to whatever IP it’s told. But using hierarchical system controlled by trusted entities in the way DNS does, we can better ensure that the response to DNS lookups are accurate.
As we seen that how many steps it requires for a full DNS lookup. Therefore we can trust our local DNS Server to cache dns lookups, so that full lookup path doesn’t have to happen for every single TCP connection.
In fact the phone, laptop, or desktop that we use as our daily driver will generally have its own temporary DNS cache as well. Hence we don’t have to bother the local name server for every TCP connection either.
One thing also necessary to mention here that most cases DNS uses TCP over UDP, although TCP uses more packets than UDP. It is because web getting complex as days passes, therefore DNS lookup responses can no longer fit in a single UDP Datagram. In such condition a DNS server would respond with a packet explaining that the response is too large. The DNS client would then establish a TCP connection in order to perform the lookup.