How DNS Works: From Domain Names to IP Addresses

Roopesh TiwariRoopesh Tiwari
4 min read

DNS (Domain name system) converts the domain name of a website to an IP address. Actually, our computer doesn’t understand the domain name (e.g. – www.google.com), it only understands the IP address (e.g. - 192.168.1.1).

So, DNS is a process in which computer(browser) finds out the real address of the website in this big internet world. Domain name is only for the human convenience, so that we can remember it.

DNS works in sequential processes, let me take you to the whole process one by one.

User Request:

When you try to find some website (e.g. – www.google.com) and write a domain name in browser, then a query is generated named as DNS query and its motive is to get the IP address of the respective website.

But there is a possibility that your browser has this IP address in cache memory because you might have visited this website earlier, so browser take that IP address and open your desired website. If it is not present in cache so it will send query to DNS server.

Recursive DNS Resolver:

Don’t afraid with the name, its just a simple server provided by your ISP (Internet service provider, e.g. Airtel, jio). Its main purpose is to process that User request (DNS query).

Fetching IP address generally takes some time, so your ISP’s server has cache memory to store mostly used IP address to fasten the process. If it is their than it will return that IP address instantly to your browser and if its not in cache than DNS resolver forward this query to root server.

Root Server:

There are 13 logical root server presents worldwide. But every logical server has many physical servers to take the load of millions of queries. Root server use anycast technology.

Anycast Technology:

  • Anycast routes the multiple queries between distributed servers (distributed servers have a shared IP address.), so that response time is less, high reliability, and prevent overloading by using load balancing.

  • Anycast always choose nearest server to resolve the query. Nearest server is decided on the basis of geographical distance from the user or on the basis of low latency and also depend on routing path.

Root server plays important role, it gives us the information about relevant TLD Server.

TLD (Top Level Domain):

TLD is top level domain. Let’s take an example (www.google.com) to understand what is TLD. In this example [ .com ] is top level domain. Some of the TLDs are:

  • Generic: [ .com ], [ .org ], [ .net ], etc.

  • Country-code: [ .in ], [ .us ], etc.

Now we will discuss about the TLD servers.

TLD Server:

Now we have a particular TLD server path according to our requested domain name. Now the query is forwarded to these servers. TLD server actually have the data of website related to particular TLD [ .com ]. These servers don’t give route directly to the website but they provide the address of Authoritative Name Server.

Authoritative Name Server:

Now we have reached the right authoritative name server (ANS).

ANS has all the information (DNS records) about domain name that help translate domain name into IP address. DNS record also contains various information about a particular domain name. Some common type of DNS records stored by ANS are:

A Record (Address Record):

This record store the IPv4 address of the domain. IPv4 is a 32-bit address. Ex- IP address ( 192.0.2.1 ).

AAAA Record (IPv6 Address):

This record has the IPv6 (128-bit address) address. Ex-( 2001:0000:3238:DFE1:0063:0000:0000:FEFB ).

MX Record (Mail Exchange Record):

It provides the mail server which receives the mail on the behalf of your domain. We can take paid third party mail server which gives us the facility of custom email like [ sales@ ], [ support@ ], etc.

Canonical Name Record:

It allows one domain name to alias another domain name. Instead of pointing directly to an IP address, a CNAME points to another domain name. Ex- we can make blog.xyz.com alias to www.xyz.com. This means that if someone search for blog.xyz.com, it will automatically direct to www.xyz.com.

NS Record:

This record stores the authoritative name server and these servers are responsible for providing DNS record for a particular domain name.

PTR record:

it is generally use for reverse DNS lookup. This means, it maps IP address to a domain name, opposite of what we are doing till now that’s why it is reverse DNS lookup. Ex- IP address 192.0.2.1 maps to www.xyz.com.

TXT Record (Text Record)

Holds text information, often used for verification purposes (like for email authentication or domain verification). Ex- [ "v=spf1 include:_spf.xyz.com ~all" ] for www.xyz.com.

DNS Resolver sends IP address to the browser:

The ANS got the IP address and now the recursive resolver pass the IP address to browser. Now browser get the exact address of your requested domain, it connects to that website, fetch all the required data and display the website.

0
Subscribe to my newsletter

Read articles from Roopesh Tiwari directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Roopesh Tiwari
Roopesh Tiwari