DNS Explained: From Names to Records
Ever wondered what is DNS, why DNS records are needed, what’s the purpose of each DNS record, and also how all DNS records work together for one website. We’re going explore these all topics in this blog.
To understand much better below are few Glossary which will help you throughout your reading.
Glossary:
OS - Operating SystemISP - Internet Service ProviderDNS - Domain Name SystemTLD - Top Level DomainTCP - Transmission Control ProtocolTLS - Transport Layer SecurityHTTP - Hypertext Transfer ProtocolDNS - Domain Name SystemIP - Internet ProtocolA record – Address RecordAAAA record – Quad-A Record (IPv6 Address Record)CNAME record – Canonical Name RecordMX record – Mail Exchange RecordNS record – Name Server RecordTXT record – Text Record
1. Before exploring answers to all these questions, first let’s see How does a browser know where a website lives?
When you open a website, DNS records work together to help your browser reach the correct server.
The journey starts the moment you type
google.cominto the address bar.The browser checks everywhere for a cached IP address including browser cache, OS cache, router cache, and even ISP cache. If it finds it, it returns it to the browser. But if it doesn’t, it kicks off the real journey.
The Recursive DNS server begins where it digs through the Global DNS Hierarchy:
The Root Server → TLD Server:
The Recursive DNS server (Recursor) goes to the root server and asks, “Do you know where google.com is?” The root server doesn’t know the full address, but it looks at the
.compart. It replies: “I don’t knowgoogle.com, but I know which name servers handle.comdomains. Go ask them.”The TLD Server → Authoritative Server:
The Recursor then goes to the TLD server which manages domains ending in
.com,.org,.co,.gov, etc., and asks, “Where is google.com?” The TLD server replies: “I don’t have the final IP, but I do know the Authoritative Name Servers that Google owns (likens1.google.com). Go ask them.”The Authoritative Server → Final IP:
Finally, the Recursor asks Google’s Authoritative server, “Where is google.com?” Since this is the source of truth for that domain, it replies with one or more valid IP addresses for
google.com.Now a TCP connection is established: your machine and Google’s server perform a TCP 3-way handshake
SYN → SYN/ACK → ACK. After the TCP connection is established, the TLS handshake takes place, which is responsible for encrypting the communication. By the end of this process, a secure HTTPS connection is ready.Once the secure connection is established, the browser sends an HTTP request to the server, and the server responds with the page content.
2. What DNS is & Why DNS records are needed?
DNS (Domain Name System) is the phonebook of the internet. It’s system that translates human friendly website names into machine friendly IP address. While humans prefer easy to remember names google.com, but the communication between computer and server happens through IP address. The DNS is the system that translate domain name to IP address
DNS records are essential for mapping the human readable domain names to the machine readable IP address. Acting as a phonebook of the internet, they ensure users can access website, receive emails, and connect to the servers. Without DNS records, the web browsers cannot reach to the server making websites unreachable.
Now, let’s understand the simple definition and what problem it solves of each record
3. A record
What it is:
Maps a domain name to an IPv4 address.
Problem it solves:
Computers understand IP addresses, not domain names. The A record tells the browser which server IP to connect to.
4. AAAA record
What it is:
Maps a domain name to an IPv6 address.
Problem it solves:
Supports modern networks that use IPv6, ensuring the website is reachable on newer internet infrastructure.
5. CNAME record
What it is:
Creates an alias that points one domain or subdomain to another domain name.
Problem it solves:
Avoids duplication. You can manage one main domain while multiple subdomains point to it.
6. MX record
What it is:
Specifies the mail servers responsible for receiving emails for a domain.
Problem it solves:
Ensures emails are delivered to the correct email servers instead of getting lost.
7. NS record
What it is:
Defines the authoritative name servers for a domain.
Problem it solves:
Tells the internet which DNS servers to ask for all DNS-related information of the domain.
8. TXT record
What it is:
Stores text-based information related to the domain.
Problem it solves:
Used for domain verification, email security (SPF, DKIM, DMARC), and ownership proof.
9. How DNS records work together for one website
When you open a website, DNS records work together to help your browser reach the correct server.
NS record tells which DNS servers control the domain.
A / AAAA records tell the exact server IP address where the website is hosted.
CNAME record helps by redirecting one domain or subdomain to another (alias).
MX record tells where emails for the domain should be delivered.
TXT record is used for verification and security, especially for emails.