What is DNS

What is DNS

DNS(Domain Name Server) :

DNS is a system that translates human-readable domain names, like www.google.com, into machine-readable IP addresses, such as 142.250.190.14, enabling computers to locate and communicate with each other on the internet. It operates as a distributed database, working through a hierarchical structure of servers.


How the DNS works :

  • When we type a website like chaicode.com in our browser, our computer tries to find the IP address.

  • First, it checks the local cache (our browser, operating system, or router) to see if it already knows the IP address.

  • If the local cache doesn’t have the IP, then the query is sent to a DNS resolver to find it.

  • Resolver sends the query to a Root DNS server, which doesn’t know the exact IP address but points to the TLD(Top Level Domain) server (e.g., .org server for this example).

  • TLD server then directs the resolver to the authoritative nameserver for chaicode.com.

  • Authoritative nameserver knows the exact IP address for chaicode.com and sends it back to the resolver.

  • Resolver passes the IP address to our computer.

  • Our computer uses the IP address to connect to the real server where the website is hosted.

  • The website loads in our browser.


Structure of DNS :

  1. Root Domain :

    The root domain is at the apex of the domain name hierarchy. Above it are the top-level domains, further divided into second-level domains, third-level domains, and so on.

  2. Top Level Domain :

    The top-level domains include generic domains, such as .com, .net, and .org, and country code top-level domains, such as .uk and .us. The second-level domains are typically used to identify an organization or business. For example, the domain name google.com consists of the second-level domain Google and the top-level domain .com.

  3. Third level Domain :

    Third-level domains identify a specific host or service associated with a domain name. For example, the domain name www.google.com consists of the third-level domain www, the second-level domain google, and the top-level domain .com.

  4. Fourth Level Domain :

    The fourth-level domains provide additional information about a particular host or service on the Internet. An example of a fourth-level domain is mail.google.com, which is used to access Google’s Gmail service.

  5. Fifth Level Domain :

    Finally, the fifth-level domains are typically used to identify a particular resource within a domain. An example of a fifth-level domain is docs.google.com, which is used to access Google’s online document storage service.


Conclusion :

The client machine sends a request to the local name server, which, if the root does not find the address in its database, sends a request to the root name server, which in turn, will route the query to a top-level domain (TLD) or authoritative name server. The root name server can also contain some hostName to IP address mappings. The Top-level domain (TLD) server always knows who the authoritative name server is. So finally the IP address is returned to the local name server which in turn returns the IP address to the host.