The domain name system (DNS)
is the Internet’s naming service that maps human-friendly domain names to machine-readable IP addresses. The service of DNS is transparent to users. When a user enters a domain name in the browser, the browser has to translate the domain name to IP address by asking the DNS infrastructure.
Name servers: It’s important to understand that the DNS isn’t a single server. It’s a complete infrastructure with numerous servers. DNS servers that respond to users’ queries are called name servers.
Resource records: The DNS database stores domain name to IP address mappings in the form of resource records (RR). The RR is the smallest unit of information that users request from the name servers. There are different types of RRs. The table below describes common RRs. The three important pieces of information are type, name, and value. The name and value change depending upon the type of the RR.
Type | Description | Name | Value | Example |
---|---|---|---|---|
A | Provides the hostname to IP address mapping | Hostname | IP address | (A, relay1.main.educative.io,104.18.2.119) |
NS | PRovides the hostname that is the authorative DNS for a domain name | Domain name | Hostname | (NS, educative.io, dns.educative.io) |
CNAME | Provides the mapping from alias to canonical hostname | Hostname | Canonical name | (CNAME, educative.io, server1.primary.educative.io) |
MX | Provides the mapping of mail server from alias to canonical hostname | Hostname | Canonical name | (MX, mail.educative.io, mailserver1.backup.educative.io) |
As stated before, the DNS isn’t a single server that accepts requests and responds to user queries. It’s a complete infrastructure with name servers at different hierarchies.
There are mainly four types of servers in the DNS hierarchy:
.com
, .edu
, .us
, and so on. For instance, when a user requests the IP address of educative.io, root-level name servers will return a list of top-level domain (TLD) servers that hold the IP addresses of the .io
domain.Example of DNS hierarchy for resolution of domain/host names
DNS names are processed from right to left. In the case of educative.io, the resolvers will first resolve the .io
part, then educative
, and so on. Visually, however, the DNS hierarchy can be viewed as a tree.
There are two ways to perform a DNS query:
Note: Typically, an iterative query is preferred to reduce query load on DNS infrastructure.
hostname.domain.com