The Domain Name System (DNS) is a critical part of how the internet functions π
a. Initiate the Request :
The journey begins when you type a domain name, such as `example.com`, into your browserβs address bar and press Enter.The browser will check if the domain is already cached locally. If not, it forwards the request to the operating system.
b. Local DNS Cache Lookup :
Your Linux machine has a local DNS cache that stores IP addresses of recently accessed domains.The system first checks this cache.If it finds the IP address here, it can proceed to connect to the server directly, speeding up the browsing experience.
c. /etc/resolv.conf Configuration :
If the domain name is not found in the local cache, the system refers to the `/etc/resolv.conf` file, which lists DNS servers configured for the machine. This file contains the IP addresses of the DNS servers that your computer queries.
d. Querying the DNS Resolver :
The Linux system sends a DNS query to one of the DNS servers listed in `/etc/resolv.conf`.These DNS servers are often provided by your Internet Service Provider (ISP) or may be public DNS servers such as Google’s DNS at `8.8.8.8`.
e. Recursive DNS Query :
The queried DNS server now takes on the task of finding the IP address. If it doesnβt have the domain name cached, it performs a recursive query. It starts by querying one of the root DNS servers.
f. Root Servers :
Root servers are the authoritative servers for the root level of the DNS hierarchy.They donβt contain IP addresses for domain names, but they know the authoritative DNS servers for all top-level domains (TLDs).The root server responds with a referral to the appropriate TLD DNS server, such as `.com`.
g. TLD Name Servers :
The DNS server queries the TLD name servers, which hold information about authoritative servers for domains within their namespace.The TLD servers respond with the authoritative DNS servers for `example.com`.
h. Authoritative DNS Servers :
The authoritative servers for `example.com` have the definitive answer.They respond to the DNS server with the IP address of the domain.
i. Caching the Response :
The DNS server caches this IP address. It then returns the IP address to your Linux machine, which also caches the response for future queries.
j. Connecting to the Web Server :
With the IP address in hand, your computer can now initiate a connection to the web server hosting `example.com` using the IP address.The browser sends an HTTP or HTTPS request to the server.
k. Receiving the Web Page :
The web server processes the request and returns the content of the website to the browser. This includes HTML, CSS, JavaScript files, images, and other media.
l. Rendering the Page :
The browser takes all the received data and renders it into a human-readable web page. It constructs the Document Object Model (DOM), applies CSS for styling, and executes JavaScript. The web page then appears on your screen in the finished form.