What is DNS? A crash course on DNS for every developer

Did you ever think who understands google.com when you type that in your address bar? 🤔

How does this magic happen? ✨ There isn’t a delivery boy to hand over an HTML page directly. Let’s understand the crux of this superfast procedure 🚀 starting from typing a URL address to getting a page in your browser. 💻

If you ever need to set up a blog/website, this is a must-know article that contains all the understanding of DNS, the lookup process, types of DNS records i.e. all you need to know explained within a single article.

DNS: Internet’s own complex library

Table of Contents

Heres the outline of this article

  1. What is DNS?
  2. Why is it required?
  3. Types of DNS servers
  4. How DNS resolution takes place via DNS servers?
  5. Types of DNS Query
  6. What is DNS caching? Where is it cached?
  7. DNS Record Types and Bonus cheatsheet
  8. Issues and Concerns

What is DNS?

DNS stands out for “Domain Name System” which translates human-readable domain names (for example, www.amazon.com) to machine-readable IP addresses (for example, DNS system is a public, hierarchical, distributed, and heavily cached database.

DNS is like the Internet’s own phonebook. Records are searched in order to identify the IP address associated with a particular name

An IP address is that unique address by which that server gets identified device on the internet (or on a local network). Once our computer/device has the IP address then we actually connect to the concerned website’s server.

Figure 1: DNS server

Thus DNS resolution of a website’s address involves a lookup process which is the DNS lookup.

Why it is required?

The domain name system (DNS) does the job of enabling a connection, for example to a website, without users having to know the corresponding IP.

Simple isn’t it? 😊

Types of DNS Servers

DNS root nameservers are known to every recursive resolver based on the extension of that domain (.com, .net, .org, etc.) and a request is further assigned to a particular TLD responsible for such extension.




The IANA breaks up the TLD servers into two main groups:

  • Generic top-level domains — domains that are not country-specific such as .com, .org, .net, .edu, and .gov.
  • Country code top-level domains — any domains that are specific to a country or state such as.uk, .us, .ru, and .jp.


How DNS resolution takes place via DNS servers ⚙️ ?

Step 1: When you enter a URL into your browser, it starts searching for the corresponding IP-address in your computer’s DNS cache. If it finds no information there, the request will be redirected until the IP address will be identified.

Step 2: Then it passes the local DNS-Server (usually your internet router), the ISP(Internet service provider) DNS-Server, and the root name server, which is accountable for the respective Top Level Domain (TLD).

Step 3: If there is still no information found, the request will be sent to the Network Information Center (NIC) responsible for the zone. In the case of the TLD “.com”, this is Verisign.

Step 4: The NIC’s server will send the address of the zone’s authoritative nameserver to the ISP. The ISP will then ask this authoritative server for the IP, and send the information through your router back to your browser. That way the website can be accessed.

Figure 2: DNS Query Resolution

Types of DNS Query

  • Recursive
  • Iterative

A typical uncached DNS lookup will involve both recursive and iterative queries. Here, in figure 2—

  1. Query no. 2 to 7 are iteratively performed by the from ISP-Local DNS a.k.a recursive resolver.
  2. DNS query after 1 is recursively performed by the recursive resolver (from the browser point of view)


What is DNS caching? Where is it cached?

The purpose of caching is to serve the last stored record for improvements in performance and reliability for future requests.


At each level, caching takes place for the fetched records using TTL and other possible cache refreshment algorithms.

Moderns web browsers can do that. For e.g. you can check in chrome at -


DNS Record Types

When you register a domain, you can set many types of DNS records. Each record has a Type, a Host, and a Value —

  • Types” are predefined
  • Host” represents the root (@) or a subdomain (www)
  • Value” is an IP or web address, or some other value.
  1. Address Mapping record (A Record) — maps a hostname to the corresponding IPv4 address.
  2. IP Version 6 Address record (AAAA Record) — maps a hostname to the corresponding IPv6 address.
  3. Canonical Name record (CNAME Record) — alias a hostname to another hostname. If a record that contains a CNAME points to another hostname, the DNS resolution is repeated with the new hostname.
    Once you define a CNAME record for a subdomain (host), you CAN'T DEFINE another record for that same subdomain. Because of this, you can’t use CNAME at the root level (where you need other records to exist)
  4. Alias Name Record (ANAME Record) — An ANAME record is like a CNAME record but at the root of your domain. That means you can point the “naked” version of your domain (like example.com ) to a hostname (like mycdn.com).
    This is like a virtual CNAME and a non-standard DNS record.
  5. Mail eXchanger record (MX Record) — specifies an SMTP email server for the domain.
  6. Name Server records (NS Record) — specifies that a DNS Zone, such as “hello.com” is delegated to a specific Authoritative Name Server, and provides the address of the name server.
  7. Reverse-lookup Pointer records (PTR Record) — allows a DNS resolver to provide an IP address and receive a hostname (reverse DNS lookup).
  8. Certificate record (CERT Record) — stores encryption certificates such as PKIX, SPKI, PGP, and so on.
  9. Service Location (SRV Record) — a service location record, like MX but for other communication protocols.
  10. Text Record (TXT Record) — typically carries machine-readable data such as opportunistic encryption, sender policy framework, etc.
  11. Start of Authority (SOA Record) — this record appears at the beginning of a DNS zone file, and indicates the Authoritative Name Server for the current DNS zone, contact details for the domain administrator, domain serial number, etc.

Bonus cheatsheet 🎉

Here is a bonus cheat sheet for remembering all the important records —

Figure 3: A cheat sheet for important DNS records

Issues and Concerns 🐛


IP addresses are the ‘room numbers’ of the Internet, enabling web traffic to arrive in the right places. DNS resolver caches are the ‘campus directory,’ and when they store faulty information, traffic goes to the wrong places until the cached information is corrected.

Because there is typically no way for DNS resolvers to verify the data in their caches, incorrect DNS information remains in the cache until the TTL expires, or until it is removed manually.


Thanks for reading this article! Feel free to leave your comments and share your feedback. Please feel free to drop any comments to improve this article.
Have a great day!😇

Computer Scientist @ Adobe Systems https://pranayaggarwal.github.io/

Get the Medium app
