Domain Name System
Understand how the Domain Name System works.
We'll cover the following
Every device connected to the internet has its unique
The Domain Name System (DNS) is a hierarchical decentralized naming system that translates human-readable domain names, such as educative.io, into IP addresses. The DNS organizes domain names into a hierarchical tree-like structure:
At the top are root domain servers, the highest authority in DNS.
Below are
(TLDs) liketop-level domains Top-level domains (TLDs) are the last part of website addresses, like ".com" or ".org." They categorize websites into groups based on their purpose or location. There are three main types: generic (for everyone), country-specific, and special-purpose TLDs. Knowing TLDs helps us identify different types of websites on the internet. .com
and country-code TLDs. Each TLD is managed by its .registry A registry is a company that sells domain registrations for one or more top-level domains, such as `.com`. Second-level domains (SLDs) sit beneath TLDs and often represent organizations. Subdomains can extend from SLDs.
DNS resolves domain names to IP addresses by traversing this hierarchy from root servers to authoritative
Domain name system is distributed globally over numerous servers, this approach provides high availability and scalability.
DNS zone
A DNS zone is a portion of the DNS namespace that a specific organization or administrator manages. It typically corresponds to a specific domain name or a subdomain that allows more granular control of DNS components, such as authoritative name servers.
Let us try to understand zones using educative.io, which is a learning platform. Within the DNS hierarchy, we can identify three distinct zones that encapsulate different aspects of the platform: learning, community, and careers. Each zone represents a logical grouping of related resources and services within the educative.io domain. For instance,
The learning zone encompasses educational content and resources, including two subdomains: courses and cloud labs.
The community zone focuses on interactive elements organized under the respective subdomains, such as blogs and discussion forums.
Finally, the careers zone may feature job listings, career-related articles, and other professional development resources tailored to the platform’s audience.
By setting up these zones, educative.io efficiently arranges its website, making it easier for users to find the content they need. Each zone acts like a separate section with its own set of web pages. This organization ensures that when users visit educative.io, they can quickly access the right information without getting lost. Behind the scenes, authoritative servers manage each zone, directing users to the correct pages when they type in a web address.
The authoritative servers host the zone file, which is a text file. The zone file also contains the
DNS Records
Record Type | Value |
SOA records | Provides authoritative information about a DNS zone, including details such as the primary name server for the zone, the email address of the zone administrator, and other zone management parameters. |
NS records | Specifies the authoritative name servers for a domain. These servers are responsible for providing DNS information about the domain. |
A records | Maps a domain name to an IPv4 address. For example, we might have an A record that maps "example.com" to "192.0.2.1". |
AAAA records | Maps a domain name to an IPv6 address. For example, we might have an A record that maps "example.com" to "2001:db8:3333:4444:5555:6666:7777:8888". |
CNAME records | Maps one domain name to another. For instance, we might use a CNAME record to point "www.example.com" to "example.com". |
MX records | Specifies mail servers responsible for receiving email on behalf of a domain. MX records often point to mail servers like "mail.example.com". |
TXT records | Stores arbitrary text information associated with a domain name. This can be used for various purposes, such as verifying domain ownership or providing SPF (Sender Policy Framework) records for email authentication. |
Each DNS record has a value set to specify how long DNS resolvers and other DNS servers should cache the record before it expires and needs to be refreshed. This value is called Time-to-Live (TTL).
In the illustration above, the authoritative server manages the DNS record for www.xyz.com
and stores the corresponding endpoint’s IP address. The Time-to-Live (TTL) for this DNS record is set to 30 minutes, indicating that the stored IP address is valid for this duration. Initially, the record’s value is set to “192.9.101.2,” which remains valid for 30 minutes.
When a DNS query is made five minutes after the record is initialized, the DNS resolver responds with the initial IP address 192.9.101.2
. The resolver then stores this value in its cache. At the 15-minute mark, another DNS query is resolved, and the resolver continues to respond with the same IP address.
However, the TTL for the record has expired when the last query is initiated after 35 minutes. Consequently, the DNS resolver requests the authoritative server for the updated value. The authoritative server responds with the new IP address, 172.19.10.21
. The resolver updates its cache with this updated value and responds to the request with the new IP address.
DNS resolution
Let’s explore how DNS resolves the domain request for educative.io. Here, we will assume that the TLD server responds with the address of the authoritative server responsible for educative.io.
Here is a brief explanation of the slides above:
Resolver and Root DNS: The client domain requests are forwarded to the DNS resolver. The DNS resolver then forwards the requests to the root server, and the root server responds with the TLD server address.
Resolver and TLD name server: The DNS resolver forwards the client request to that TLD server. The TLD server interprets the request and responds with the address of the responsible authoritative server.
Resolver and authoritative server: The DNS resolver receives the response from the TLD server and forwards the request to the responsible authoritative server. The authoritative server contains the Resource records and zone files for each domain. The authoritative server resolves the query and responds to the DNS resolver with the educative.io server’s IP address.
Response to the user: The DNS resolver provides the client with the response and stores this response in its cache memory for any possible requests that it might receive in the future. The user connects to the server to access educative.io.
Get hands-on with 1300+ tech skills courses.