What is DNS?
Whenever we make a search on the internet, we generally request some services of the server. We make use of user-friendly words and keywords to request the services, or make the search. But, we know that the computer understands only the low-level binary data, not the user-friendly data. We also know that each device on the network has an IP(Internet Protocol) address through which we can reach to that device. The IP address can be in decimal, hexadecimal, or alphanumeric format, which is very tough for a user to remember. So, they use the user-friendly keywords to search the devices over the network. Thus, we need to map the user-friendly keywords with the IP addresses to make use of it.
Previously, when the number of server machines or websites was less, there is a centralized file containing the key-value pair. Here, the user-friendly name acts as a key, while the IP address acts as a value. This file simply performs the mapping of keys and values together. But with the advancement of technology and an excessive increase in the number of server machines or websites, the centralized file fails to provide the mapping. Thus, we need a system to structure these things to meet the present-day mapping requirements, and hence we use a Domain Name System(DNS).
So, in this blog, we'll mainly learn about the Domain Name System(DNS) in detail. We'll also see the working of the DNS, and its two types, i.e., Authoritative, and Recursive DNS.
Now, let us study these things one by one.
DNS(Domain Name System)
The Domain Name System(DNS) is a system that is used to map an IP address with an alias name. It is much similar to a telephone book, where we store the names corresponding to the phone numbers. DNS mainly translates the user-friendly domain names to IP addresses, so that the user can access the contents stored at that IP address. For Example, www.demo.com can be the domain name for an IP address say, 198.115. 212.1.
DNS records are distributed across the globe. All the information of the DNS system is decentralized, so as to reduce the dependency on a centralized source. Hence, the host computers can access the nearest computer holding the domain system information.
Following are the key terms associated with DNS:
- Namespace: A namespace assigns a unique name to each address. This is so because each device has a unique IP address on the network. A namespace is of following two types:
- Flat: A flat namespace has no defined structure for assigning the alias name to the IP address. The name assigned using a flat namespace is just a sequence of characters. It is mainly preferred for small systems, where the number of IP addresses is less.
- Hierarchical: A hierarchical namespace has a defined structure for assigning an alias name to an IP address. The alias name constitutes of several parts. This kind of namespace is good for large systems having numerous devices with numerous IP addresses. The main advantage of using a hierarchical namespace is that it can be decentralized, removing the dependency from a central location.
- Domain Name Space: Domain namespace uses hierarchical namespace. The names can be derived using an inverted tree-like structure with the root at the top. The maximum number of levels in a tree can be 128(that ranges from 0 to 127).
- Label: A label is assigned to each node in the inverted tree(that is used for Domain Name Space). It specifies the name of a particular node in the system and can be depicted using a string of 63 characters maximum. A label must be unique in order to reduce the ambiguity and enhance uniqueness in the Domain name.
- Domain Name: A Domain name is a sequence of labels separated by dots(.). It is always read from the child to the root node in the inverted tree. For example: if the root node's label is 'com', the intermediate node's label is 'demo', and the child node's label is 'abc'. Then this domain name can be written as 'abc.demo.com'.
- TLD: TLD stands for Top Level Domains. These are the domains that are mostly used. Also, each TLD is capable of holding various domains. They are mainly 2-3 characters in length. For Example, com, edu, org, in, us, etc.
Following are the two classifications of Domain Name System:
- Authoritative DNS: An Authoritative DNS is also known as a domain provider or registrar. It answers the DNS queries by translating the domain names into the equivalent IP addresses. Authoritative DNS has the final authority over a domain name and is responsible for fulfilling the queries of the Recursive DNS. For Example, Amazon Route 53, etc.
- Recursive DNS: A Recursive DNS is also referred to as the Resolver DNS. It acts as a mediator between the application program at the host computer and the Authoritative DNS. It forwards the domain name queries to the Authoritative DNS to get the equivalent IP addresses. So that the application program can access the contents on that IP address. When it fetches the IP address for a specific domain name for the first time, it stores it temporarily its cache memory. So as to reduce the unnecessary overhead to find the same IP address next time.
Working of DNS:
The host computer uses some application programs to access the domain name. The application program communicates to the Recursive DNS, which in turn communicates to the Authoritative DNS to translate the domain name to the equivalent IP address. Hence, the contents of that IP address can be fetched and displayed on the application program.
This is all about the Domain Name System, it's working, and various types. Hope you learned something new today. That's it for this blog.
Keep Learning :)