How does DNS work ?

DNS stands for Domain Name System, which is a system used to translate human-friendly domain names like www.google.com into IP addresses like 172.217.4.206, which are used by computers to communicate with each other over the internet.

When a user enters a domain name in a web browser, the browser sends a request to a DNS resolver to find the IP address associated with the domain name. The resolver then sends a request to a DNS server to look up the IP address associated with the domain name.

The DNS server first checks its local cache to see if it already has the IP address associated with the domain name. If it does, it returns the IP address to the resolver, which then sends it back to the web browser. If it doesn’t have the IP address, the DNS server sends a request to other DNS servers in the hierarchy to find the IP address.

The DNS hierarchy is organized into zones, with the root zone at the top, followed by top-level domains (TLDs) like .com, .org, and .net, and then lower-level domains like google.com or amazon.com. Each zone has one or more authoritative DNS servers that can provide the IP address associated with a domain name.

When a DNS server doesn’t have the IP address associated with a domain name, it sends a request to the next DNS server in the hierarchy, starting with the root zone. Eventually, a DNS server in the hierarchy will have the IP address associated with the domain name and will return it to the resolver, which then sends it back to the web browser.

Once the web browser has the IP address associated with the domain name, it can use it to establish a connection with the server hosting the website and request the content associated with the domain name.

Example

Let’s say you want to visit the website www.google.com. When you enter this domain name in your web browser, your computer will send a DNS query to a DNS resolver (usually provided by your internet service provider). The query will ask the resolver to find the IP address associated with the domain name.

The DNS resolver first checks its local cache to see if it already has the IP address associated with the domain name. If it does, it will return the IP address to your computer’s web browser and the connection can be established. If it doesn’t have the IP address, the resolver will send a request to a DNS server to look up the IP address.

The DNS server will first check its local cache to see if it already has the IP address associated with the domain name. If it doesn’t, it will send a request to other DNS servers in the hierarchy to find the IP address. This request will be sent to the root zone, followed by the TLD servers (in this case, the .com TLD server), and then the authoritative DNS server for the domain name (in this case, the authoritative DNS server for google.com).

Once the authoritative DNS server for google.com receives the request, it will look up the IP address associated with the domain name and send it back to the DNS server that made the request. This IP address will be sent back up the hierarchy to the DNS resolver, which will then return it to your computer’s web browser.

Your computer’s web browser can then use this IP address to establish a connection with the server hosting the website. The server will receive the request and send back the content associated with the domain name, allowing you to view the website.

DNS is an essential part of the internet and allows users to access websites and other resources by using human-friendly domain names instead of hard-to-remember IP addresses. Without DNS, users would have to remember the IP addresses of all the websites they want to visit, which would be impractical and inconvenient.

Author: tonyhughes