Domain Name System (DNS) is a distributed system that maintains mapping of human readable domain names such as 'www.google.com' to their IP addresses.
When a user enters a domain name on the browser URL the request is sent to a DNS server provided by the user's ISP. The DNS server checks if it has the IP address for the domain, else it sends a lookup request to other DNS servers.
The DNS server then returns the IP address back to the browser, which receives the web page by contacting the server by it IP address.
DNS servers can be classified into one of the following categories. These DNS servers collaborate to return a specific IP address for a specific domain to the web client.
Recursive resolvers
Root Nameservers
TLD Nameservers
Authoritative Nameservers
1. User enters the URL, say 'www.google.com' on the browser.
2. Browser, via the ISP, sends the request to DNS resolver to get the IP address of the server where page or content is hosted.
3. DNS resolver checks if it has the IP address for the domain www.google.com in its cache. If it has the IP address in it cache then it sends the IP address back to the browser.
If it does not have the IP address in its cache then it forwards the request to Rootname server to get the IP address of the server where page or content is hosted.
4. DNS resolver sends the request to TLD Nameserver to get the IP address of the server where page or content is hosted.
5. TLD Nameserver sends the request to Authoritative Nameserver to get the IP adress of the server where page or content is hosted.
6. Once browser received the IP address it contacts the server and loads the page.
DNS records, also known as zone files, provide information about a specific domain - such as the domains IP address, and how to handle requests for that domain. DNS records live in authoritative nameservers and have an associated TTL (Time To Live).
Some common DNS records are - A record, CNAME record, MX record, TXT record, NS record, and SRV record