A brief introduction to DNS
What is DNS ?
The Domain Name System (DNS) is the phonebook of the Internet. Humans access information online through domain names, like nytimes.com or espn.com. The Web browsers interact through Internet Protocol (IP) addresses and the DNS translates the domain names to IP addresses so that, the browsers can load Internet resources.
Each device connected to the Internet has a unique IP address which is used by other machines to locate the device. DNS servers eliminate the need for humans to memorize IP addresses such as 192.168.1.1 (in IPv4), or more complex newer alphanumeric IP addresses such as 2400:cb00:2048:1::c629:d7a2 (in IPv6).
How does DNS work ?
DNS resolution is the process of translating a hostname, like example.com, into an IP address that is understandable by computers, such as 192.168.1.1. It is like a street address that may be used to find a specific house. An IP address is a unique identifier that is assigned to every device on the internet.
'Behind the scenes' operations, which involve no user engagement after the initial request, is what we need to examine in order to comprehend how DNS functions.
There are 4 DNS server involved in loading a webpage:
DNS Recursor: This can be thought of as a program that receives the query from the client and makes additional requests to satisfy the client's DNS query.
Root NameServer: In order to resolve a DNS query, start here. It serves as a guide, indicating the next step to locate the TLD (Top-Level Domain) Name Server. With over 700 separate servers for redundancy and 13 different types of root name servers dispersed throughout the world, DNS resolution is guaranteed even in the event that some servers go down.
TLD NameServer: For Top-Level Domain, TLD stands. After a DNS query has been answered, the final portion of the domain name—such as the.com in example.com—is hosted in this stage.
Authoritative NameServer - This completes the process using this nameserver. It gives the IP address for the requested domain, such as
example.com
, and can be compared to a dictionary that stores domain names.By following these steps, the DNS system efficiently translates human-readable domain names into IP addresses, allowing users to access websites without needing to remember numerical addresses.
Steps in DNS Lookup
There are 8 steps in a DNS lookup:
A user types
example.com
into a web browser, and the query travels into the Internet and is received by a DNS recursive resolver.The resolver then queries a DNS rool nameserver (.).
The root server then responds to the resolver with the address of a TLD DNS Server ( such as
.com
or.net
), which stores the informaiton for its domains. When searching forexample.com
, our request is pointed toward the.com
TLD.The resolver then makes a
.com
request to the.com
TLDTHe TLD server then responds with the IP address of the domain's nameserver,
example.com
.Lastly, the recursive resolver sends a query to the domain's nameserver.
The IP address for
example.com
is then returned to the resolver from the nameserver.The DNS resolver then responds to the web browser with the IP address of the domain requested initially.
Once the 8 steps of the DNS lookup have returned the IP address for example.com
the browser is able to make the request for the webpage:
The browser makes a HTTP request to the IP address
The server at that IP returns the webpage to be rendered in the browser.
DNS Records
DNS records ( also zone files ) are instructions that live in authoritative DNS Server and provide information about a domain including what IP Address is associated with that domain and how to handle requests for that domain. Their records consist of a series of text files written in, what is known as DNS syntax. DNS Syntax is just a string of characters used as commands that tell the DNS server what to do. All DNS records also have a TTL ( Time To Live ), and indicates how often a DNS server will refresh that record.
Common types of DNS Records
A Record: The record that holds the IP address of the domain
CNAME Record: Forwards one domain or subdomain to another domain, does NOT provide an IP address
AAAA Record: The record that contains the IPv6 address for a domain ( as opposed to A records, which list the IPv4 addresses ).
MX Record: Directs mail to an email server.
TXT Record: Let's an admin store text notes in the record. These records are often used for email security
NS Record: Stores the name server for a DNS entry.
SOA Record: Stores admin information about a domain.
SRV Record: Provides a domain name in reverse-lookups
Sources
Subscribe to my newsletter
Read articles from Kumar Priyanshu directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Kumar Priyanshu
Kumar Priyanshu
I am a developer from India, and I am always on a lookout for new and exciting technology.