DNS (Domain Name System)
Last updated
Last updated
The Domain Name System (DNS) is a decentralized naming system for devices and services connected to the internet or private networks. It translates human-friendly domain names (like google.com) into machine-friendly IP addresses (such as 192.168.0.1). This allows browsers to locate and load resources on the internet without needing to memorize numerical IP addresses.
DNS (Domain Name System) operates at the Application Layer (Layer 7) of the OSI model.
DNS resolves human-readable domain names into IP addresses. This process involves four main components:
DNS Recursor: A server acting as a "librarian" that receives queries from browsers and initiates additional requests to fulfill the DNS query.
Root Nameserver: The first step in finding an IP address, similar to a library index, directing the query to more specific servers.
TLD Nameserver: Points to servers associated with the top-level domain (like .com or .net).
Authoritative Nameserver: The final stop that stores the actual IP address for the requested domain.
A user types in a domain like "example.com."
The browser queries a DNS resolver.
The recursor asks the root nameserver, which points to the relevant TLD server.
The TLD server provides the IP address of the domain’s nameserver.
The recursor gets the IP address from the authoritative nameserver and returns it to the browser.
The browser can now load the web page by sending a request to that IP.
Here's another image showing the step by step process:
Recursive Query: The DNS client expects a definitive answer (either the record or an error).
Iterative Query: The DNS server returns the best possible answer or a referral to another server.
Non-Recursive Query: This occurs when the DNS resolver already has the information cached and returns it without needing further queries.
To speed up the process, DNS records are cached in various locations:
Browser Cache: Modern browsers store DNS records locally for a short time.
Operating System Cache: The OS also caches DNS records to avoid repetitive queries.
ISP Caching: ISPs store frequently requested DNS records to reduce query time further.
In some cases, Cloudflare DNS optimizes this process with infrastructure designed to handle high traffic, such as root DNS servers.