Have you ever wondered how does typing google.com
on any browser takes us to the Google’s search site
Interestingly typing google.co
also takes us to google.com
?
Ever wondered how does these domain names work behind the scenes ?
Yes they are called domain names
Let us dive deep into understanding the domain names and their functioning.
Domain Names
One of the reason behind you visiting any site is because you remember the names of the sites. These name given to the sites are what's called domain names
( a CS / fancier term to name websites ). But if you have ever understood internet and it's working ( if not visit here ), then you might actually know that internet is just computers connected to each other via network.
So how does one computer visits another computer with these names ? are these names unique ? is someone maintaining records of these names ? let us find out
IP Address
IP addresses are unique addresses given to each computer.
So, if they are unique to each computer, are domain names the same as IPs?
Not exactly. IP addresses are just a set of numbers and look something like 172.168.0.128
. There are majorly two version of IP Addresses in use i.e. IPv4 and IPv6. IPv4. IPv4 looks like 192.168.1.1
while IPv5 is like 2001:0db8:85a3:0000:0000:8a2e:0370:7334
. IPv4 is older and limited while IPv6 offers vast space and also improved security.
We can use these numbers to access the server
(a computer storing the website information), but these numbers are hard to remember. This is where DNS comes in.
Domain Name System ( Domain Name System )
Think of IP addresses like phone numbers of your family and friends. Can you remember the numbers of every person? — Maybe, but it’s difficult, right?
So, you save them in your contacts/phone app and give each person a name. Now it’s much easier.
Imagine the Domain Name System (DNS) as the same method of assigning names to each of the IP addresses of computers around the world. Now that you’ve assigned names to the IP addresses, you can simply remember the name and type it in your browser to access the information served by the specific computer you’re requesting.
Do each computer has domain name ?
Now, you might wonder: does every computer's IP automatically have a name assigned to it? The answer is no.
Just like you have to manually add numbers to your contacts when you get a new phone, you also need to assign a domain name to your computer’s IP address (or server) yourself.
But since you don’t own the internet in this case, you need someone authorized to actually assign the name to your computer.
This is where services like GoDaddy
come into play. They are authorized sources that can provide you with domain names, which you can then point to your computer's IP address.
It’s like telling your parents to save a number in their phone with a specific name, since you don’t own the phone.
Flow of resolving DNS ( DNS Resolution )
There are majorly 4 DNS servers resolving and loading your website request on the internet. The flow of it is as below:
DNS Recursive Resolver
This is the client’s device that requests IP addresses. Why "recursive"? Because the request is solved recursively. The client is calling someone to ask for the phone number of a particular person, but the client doesn’t know who to call first.
Example: "What is the IP address of
example.com
?"Root Name Server
Root name servers are the servers that store information about top-level domains. Top-level domains are the last part of your website address, like .com, .ai, .org, .co, etc. There are 13 root name server distributed across the globe. The root server is like a directory or guidebook that knows the number of a person who can provide information about a specific group, such as "all people who have the
.com
suffix."Example: "I don’t know exactly, but you can ask the
.com
TLD server for that information."TLD (Top Level Domain) Server
After the root name server points the request to a TLD server, the TLD server guides you further. The TLD server is like calling someone who knows the phone numbers of all people with the
.com
domain, such as the office ofexample.com
. The TLD server doesn’t have the exact number, but it narrows down where to look next.Example: "I don’t know the specific IP address for
example.com
, but I can tell you where the authoritative server forexample.com
is."Authoritative Name Server
The authoritative name server holds the final piece of the puzzle. This server provides the accurate information—the specific IP address associated with the domain. This is like calling the exact person who knows the phone number for
example.com
—they provide the direct and accurate answer.Example: "The IP address for
example.com
is93.184.216.34
."
But is this long process all repeated when we visit any website ?
No, the entire DNS resolution process is not repeated each time you visit a website. After the first request, the DNS information (like IP addresses) is cached at various levels—on your device, at DNS resolvers, and sometimes even at the authoritative DNS servers. This caching speeds up future visits. The caching time is determined by TTL ( Time To Live ) value of DNS records.
Types of DNS Records
But the Authoritative Name Server can also categorize the server into some kind of categories called DNS records. Some of the major DNS records are listed in the table below:
Record Type | Purpose | Example |
A Record | Maps a domain to an IPv4 address | example.com → 93.184.216.34 |
AAAA Record | Maps a domain to an IPv6 address | example.com → 2606:2800:220:1:248:1893:25c8:1946 |
CNAME Record | Alias one domain to another | www.google.co → google.com |
MX Record | Specifies mail servers for a domain | example.com → mail.example.com (Priority 10) |
TXT Record | Stores text information, often for verification | example.com → "v=spf1 include:_ spf.google.com ~all" |
NS Record | Specifies the authoritative name servers for a domain | example.com → ns1.examplehost.com |
Now you know the redirection from google.co to google.com is due to a CNAME record.
Summary
The DNS is a very useful tool that ensures easy use of the internet. It simplifies the connection between the client and the server. The process through which the typed address gets the IP address of the respective server is called DNS resolution. It involves the Root Name Server, TLD Server, and Authoritative Name Server. The Authoritative Server further categorizes the information into different records. Major records include:
A Record: Directly assigns an IPv4 address.
AAAA Record: Assigns an IPv6 address.
CNAME Record: Acts as an alias for another domain.
NS Record: Points to another authoritative name server.
If you found the blog useful, feel free to drop a like and follow!