Imagine you want to visit a website like google.com. You type the name into your browser, but computers don't normally use names like humans do. Network communication ultimately uses IP addresses.
So how does your computer find the IP address of google.com?
The answer is DNS.
DNS (Domain Name System) is a distributed system that translates domain names into IP addresses and also provides other information about domains.
In simple words:
DNS works like the Internet's phonebook. It helps your device find the IP address associated with a domain name.
For example:
google.com
↓
DNS
↓
IP Address
↓
Connect to Server
Why Do We Need DNS?
Imagine having to remember an IP address for every website you visit.
Instead of:
142.250.x.x
you can simply remember:
google.com
Domain names are easier for humans to read and remember, while IP addresses are used by network protocols to identify destinations.
DNS provides the translation between these names and addresses.
How Does DNS Work?
Suppose you type:
www.example.com
into your browser.
A simplified DNS process looks like this:
Browser
↓
DNS Resolver
↓
DNS Servers
↓
IP Address
↓
Web Server
The resolver finds the appropriate DNS information and returns an IP address to your device.
Your browser can then use that IP address to establish a connection to the web server.
DNS Resolver
The DNS resolver is responsible for finding DNS information on behalf of your device.
Your computer or router is usually configured to use a recursive DNS resolver, which may be operated by an ISP, organization, or public DNS provider.
For example:
Your Computer
↓
Recursive Resolver
↓
DNS Hierarchy
↓
Answer
↓
Your Computer
The resolver may already have the answer in its cache, in which case it can respond without querying the DNS hierarchy again.
DNS Hierarchy
DNS is organized hierarchically rather than being controlled by one giant server.
A simplified hierarchy looks like this:
Root
|
┌───────┴───────┐
.com .org
|
example
|
www
The important parts are:
Root
Top-Level Domain (TLD)
Authoritative DNS server
Let's understand them.
1. Root DNS Servers
At the top of the DNS hierarchy are the root DNS servers.
They don't normally provide the final IP address for a website. Instead, they help direct DNS resolvers toward the appropriate TLD servers.
For example, if the domain ends in .com, the root system can direct the resolver toward the .com TLD servers.
2. TLD Servers
TLD stands for Top-Level Domain.
Examples include:
.com.org.net.in.edu
TLD servers know where to find the authoritative DNS servers for domains within their TLD.
For example:
example.com
↓
Root
↓
.com TLD
↓
Authoritative Server
3. Authoritative DNS Server
An authoritative DNS server contains the actual DNS records for a domain.
For example, it may contain a record that says:
example.com → 203.0.113.10
The authoritative server provides the official DNS answer for that domain.
DNS Resolution Example
Let's say you enter:
www.example.com
Your computer needs the IP address.
A simplified resolution process is:
1. Computer asks DNS Resolver
↓
2. Resolver checks its cache
↓
3. If needed, asks Root
↓
4. Root points to .com TLD
↓
5. TLD points to authoritative server
↓
6. Authoritative server provides DNS record
↓
7. Resolver returns answer to computer
After receiving the IP address, your browser can connect to the destination.
DNS Records
DNS does more than just map names to IPv4 addresses. It uses different types of DNS records for different purposes.
Record | Purpose |
|---|---|
A | Maps a name to an IPv4 address |
AAAA | Maps a name to an IPv6 address |
CNAME | Creates an alias for another domain name |
MX | Specifies mail servers for a domain |
NS | Identifies authoritative name servers |
TXT | Stores text information, often used for verification and email-related policies |
PTR | Used for reverse DNS lookups |
For example:
example.com
|
├── A → IPv4 address
├── AAAA → IPv6 address
├── MX → Mail server
└── NS → Name server
DNS Caching
DNS lookups don't have to start from the root every time.
DNS information can be cached by:
Your operating system
Your browser
Your home router
A recursive DNS resolver
This makes future lookups faster and reduces unnecessary DNS traffic.
DNS records have a TTL (Time to Live) value that tells caches how long the information can generally be retained before it should be refreshed.
DNS and UDP/TCP
DNS commonly uses UDP port 53 for ordinary queries because UDP has low overhead.
However, DNS can also use TCP port 53, including situations where a response is too large for the applicable UDP exchange or for certain DNS operations such as zone transfers.
Modern DNS technologies can also use other transports. For example, DNS over HTTPS (DoH) carries DNS queries inside HTTPS, while DNS over TLS (DoT) uses TLS to protect DNS traffic.
Forward and Reverse DNS
DNS can work in both directions.
Forward DNS
A forward lookup finds an IP address from a domain name.
example.com
↓
IP Address
This is the type of lookup you commonly need when visiting a website.
Reverse DNS
A reverse DNS lookup attempts to find a domain name associated with an IP address.
IP Address
↓
Domain Name
Reverse DNS commonly uses PTR records.
DNS Security
Because DNS plays such an important role, attackers can try to manipulate DNS information.
One important threat is DNS cache poisoning, where incorrect DNS information is inserted into a cache so users can be directed to the wrong destination.
DNSSEC can help protect DNS data by providing authentication of DNS responses through cryptographic signatures.
However, DNSSEC does not encrypt DNS queries.
For privacy, technologies such as DoH and DoT can encrypt DNS communication between a client and its resolver.
DNS Example in Everyday Life
Suppose you type:
www.example.com
into your browser.
Behind the scenes:
Domain Name
↓
DNS Lookup
↓
IP Address
↓
TCP/QUIC Connection
↓
HTTP/HTTPS
↓
Website
You don't normally notice the DNS step because it happens very quickly.
DNS vs IP Address
DNS | IP Address |
|---|---|
System for resolving domain names and other DNS information | Logical address used by IP |
Human-friendly names | Network-friendly addresses |
Example: | Example: |
Uses DNS records | Used for packet delivery and routing |
A simple way to remember it:
DNS tells you which IP address belongs to a name.
Conclusion
DNS (Domain Name System) is a distributed naming system that helps translate domain names into IP addresses and provides other information about domains.
The basic process is:
Domain Name → DNS Resolver → DNS Hierarchy → DNS Record → IP Address
The most important concepts to remember are:
DNS Resolver → Finds DNS information for clients
Root Servers → Direct resolvers toward TLD servers
TLD Servers → Direct resolvers toward authoritative servers
Authoritative Server → Provides official DNS records
A Record → IPv4 address
AAAA Record → IPv6 address
MX Record → Mail server
CNAME → Alias
PTR → Reverse DNS
Caching → Makes repeated lookups faster
So, the next time you type a website name into your browser, remember that DNS is one of the first systems working behind the scenes to help your device find where that website lives on the network.