Open In App

Details on DNS

Last Updated : 07 Jul, 2022
Like Article

DNS (Domain Name System) allows you to interact with devices on the Internet without having to remember long strings of numbers. Each computer on the Internet has its own unique address, known as an IP address, just like every home has a unique address for sending direct mail. is an IP address consisting of four sets of numbers extending from 0 to 255 separated by a period. It’s not easy having to remember this complicated collection of numbers every time you want to access a website, which is where DNS comes in handy. can be remembered instead of

Domain Hierarchy:

TLD (Top-Level Domain) is the rightmost part of a domain name. The TLD for is “.com”. TLDs are divided into two categories: gTLDs (generic top-level domains) and ccTLDs (country code top-level domains). Historically, the purpose of a common top-level domain (gTLD) was to inform users of the purpose of the domain name; For example, would be for business purposes, .org for organization, .edu for education, and .gov for the government. And a country code top-level domain (ccTLD) was used for geographic purposes, such as .ca for Canadian sites, for UK sites, and so on. As a result of the high demand, many new gTLDs have emerged,,.club,.website,.biz, and many others.

SLD(Second-Level Domain): The .org component of is the top-level domain, while geeksforgeeks is the second-level domain. Second-level domains can only contain a-z 0-9 and hyphens and are limited to 63 characters and TLDs when registering a domain name (may not start or end with hyphens or contain consecutive hyphens).

Subdomain: A period is used to separate a subdomain from a second-level domain. For example, the admin part is a subdomain named A subdomain name, like a second-level domain, is restricted to 63 characters and can only contain the letters a-z, 0-9, and hyphens (cannot begin or end with hyphens or consecutive hyphens).To create longer names, you can use multiple subdomains separated by periods, such as However, the maximum length should not exceed 253 characters. You can create as many subdomains as you want for your domain name.

DNS Record Types: However, DNS is not just for websites, and there are many other types of DNS records as well. We’ll go through some of the most common ones you’re likely to encounter.

  • A Record –
    For example, is an IPv4 address that these entries resolve to.
  • AAAA Record –
    For example, 2506:4700:20::681a:bc6 resolves to an IPv6 address.
  • CNAME Record –
    For example, the subdomain name of Geeksforgeeks’s online shop is, which gives a CNAME record of To determine the IP address, another DNS request will be sent to
  • MX Record – 
    These records point to the servers that handle the email for the domain you are looking for. For example, the MX record response for would look like There is also a priority sign on these documents. It instructs the client in which order to try the servers. This is useful when the primary server fails and the email needs to be sent to a backup server.
  • TXT Record –
    TXT records are text fields that can be used to store any text-based data. TXT records can be used for a variety of things, but one of the most common is to identify the server that has the authorization to send an email on behalf of the domain (this can help in the fight against spam and fake email). is). They can also be used to verify domain ownership when registering for third-party services.

When you make a DNS request, what happens?

  • When you request a domain name, your computer first checks its local cache to see if you have recently visited the address. If you haven’t, your computer will send a request to your recursive DNS server.
  • Your ISP will typically provide you with a recursive DNS server, but you can also use your own. A local cache of recently discovered domain names is also kept on this server. If a local result is discovered, it is returned to your computer, and your request is completed (this is common for popular and highly requested services such as Google, Facebook, Twitter). If the request cannot be met locally, a journey begins with the Internet’s root DNS server to locate the appropriate response.
  • Root servers act as the DNS backbone of the Internet, leading you to the appropriate top-level domain servers based on your request. For example, if you request, the root server will recognize the .org top-level domain and direct you to the appropriate TLD server for .org addresses.
  • The TLD server keeps track of where to look for authoritative servers that respond to DNS requests. Authoritative servers are sometimes referred to as domain nameservers. and, for example, are name servers for Multiple nameservers for one domain name are often used as backups in case they go down.
  • An authoritative DNS server is the server that stores the DNS records for a domain name and where any modifications are made to the DNS records for that domain name. The DNS record is then transmitted to the recursive DNS server, where a local copy is cached for future queries and later sent back to the originating client making the request based on the record type.

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads