Details on DNS
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. 184.108.40.206 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. geeksforgeeks.org can be remembered instead of 220.127.116.11.
TLD (Top-Level Domain) is the rightmost part of a domain name. The TLD for geeksforgeeks.com 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, a.com 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, .co.uk for UK sites, and so on. As a result of the high demand, many new gTLDs have emerged, including.online,.club,.website,.biz, and many others.
SLD(Second-Level Domain): The .org component of geeksforgeeks.org 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 admin.geeksforgeeks.org. 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 mailer.servers.geeksforgeeks.org. 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, 18.104.22.168 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 marketing.geeksforgeeks.org, which gives a CNAME record of marketing.shopify.com. To determine the IP address, another DNS request will be sent to marketing.shopify.com.
- 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 geeksforgeeks.com would look like alt1.aspmx.l.google.com. 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 www.geeksforgeeks.org, 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. kip.ns.cloudflare.com and uma.ns.cloudflare.com, for example, are name servers for geeksforgeeks.org. 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.