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.
Table of Contents
Here’s the outline of this article
- What is DNS?
- Why is it required?
- Types of DNS servers
- How DNS resolution takes place via DNS servers?
- Types of DNS Query
- What is DNS caching? Where is it cached?
- DNS Record Types and Bonus cheatsheet
- 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,
192.0.2.44). 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.
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
1. Root Name Server
DNS root nameservers are known to every recursive resolver based on the extension of that domain (
.org, etc.) and a request is further assigned to a particular TLD responsible for such extension.
The root nameservers are overseen by a nonprofit called the Internet Corporation for Assigned Names and Numbers (ICANN).
2. TLD Name Server
A TLD nameserver maintains information for all the domain names that share a common domain extension, such as
Management of TLD nameservers is handled by the Internet Assigned Numbers Authority (IANA), which is a branch of ICANN.
The IANA breaks up the TLD servers into two main groups:
- Generic top-level domains — domains that are not country-specific such as
- Country code top-level domains — any domains that are specific to a country or state such as
3. Authoritative Name Server
When a recursive resolver receives a response from a TLD nameserver, that response will direct the resolver to an authoritative nameserver. The authoritative nameserver is usually the resolver’s last step in the journey for an IP address.
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.
Types of DNS Query
A typical uncached DNS lookup will involve both recursive and iterative queries. Here, in figure 2—
- Query no. 2 to 7 are iteratively performed by the from ISP-Local DNS a.k.a recursive resolver.
- DNS query after 1 is recursively performed by the recursive resolver (from the browser point of view)
A typical uncached DNS lookup will involve both recursive and iterative queries.
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.
DNS caching involves storing data closer to the requesting client so that the DNS query can be resolved earlier and additional queries further down the DNS lookup chain can be avoided, thereby improving load times and reducing bandwidth/CPU consumption. DNS data can be cached in a variety of locations, each of which will store DNS records for a set amount of time determined by a time-to-live (TTL).
At each level, caching takes place for the fetched records using TTL and other possible cache refreshment algorithms.
1. Browser level
Moderns web browsers can do that. For e.g. you can check in chrome at -
2. Operating System Level
The operating system level DNS resolver is the second and last local stop before a DNS query leaves your machine. The process inside your operating system that is designed to handle this query is commonly called a “stub resolver” or DNS client.
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 (
- “Value” is an IP or web address, or some other value.
- Address Mapping record (A Record) — maps a hostname to the corresponding IPv4 address.
- IP Version 6 Address record (AAAA Record) — maps a hostname to the corresponding IPv6 address.
- 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
CNAMErecord for a subdomain (host), you CAN'T DEFINE another record for that same subdomain. Because of this, you can’t use
CNAMEat the root level (where you need other records to exist)
- 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.
- Mail eXchanger record (MX Record) — specifies an SMTP email server for the domain.
- 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.
- Reverse-lookup Pointer records (PTR Record) — allows a DNS resolver to provide an IP address and receive a hostname (reverse DNS lookup).
- Certificate record (CERT Record) — stores encryption certificates such as PKIX, SPKI, PGP, and so on.
- Service Location (SRV Record) — a service location record, like MX but for other communication protocols.
- Text Record (TXT Record) — typically carries machine-readable data such as opportunistic encryption, sender policy framework, etc.
- 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 —
Issues and Concerns 🐛
DNS cache poisoning is the act of entering false information into a DNS cache so that DNS queries return an incorrect response and users are directed to the wrong websites. DNS cache poisoning is also known as ‘DNS spoofing.’
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.
A more secure DNS protocol called DNSSEC aims to solve some of these problems, but it has not been widely adopted yet.
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!😇
Please feel free to buy me a coffee ☕ => HERE 😊