top of page
Programming

What is DNS? How does DNS work? Types of DNS Servers- Backend Development Series

Updated: Dec 9, 2022



Have you ever wondered what happens behind the scenes after you enter a URL in the browser? How does the browser know where to find the data belonging to a website?

The answer is DNS (Domain Name System). Without DNS, the whole internet framework would collapse. The internet is actually computers that are interconnected by lots of wires. The DNS is responsible for mapping these computers with the URLs.


If you are a software developer, a DevOps engineer, or a computer science student, you would need to know about how DNS works and this blog is for you.


Let's dive right in -

  1. What is DNS? - Definition

  2. How does a DNS query work?

  3. 4 Types of DNS Servers and What happens when an HTTPS request is made?

  4. DNS Records

  5. What are DNS Records?

  6. Frequently used DNS records

  7. Risks of DNS

  8. Alternate DNS Servers


What is DNS? - Definition

What is DNS in computer networks?

DNS stands for Domain Name System. It is a system that allows us to find the IP address of a website or server.

DNS is a hierarchical naming system for computers, services, or other resources connected to the Internet or a private network.


The name "DNS" derives from its role as a directory for the Domain Name System (a tree-structured system). The DNS hierarchy consists of domains, which are collections of subdomains (e.g., "example.com" can contain "subdomain1.example.com", "subdomain2.example.com", etc.), and DNS records which map domain names to IP addresses and identify other information about those domains (e.g., which mail servers handle email for that domain).



How does a DNS query work?

The internet as we know it today is actually computers present somewhere in the world, and everything is interconnected using wires. Each computer is identified using a string of numbers called IP addresses. These IP addresses are unique to the computer/machine.


If you want to get data from any one computer, you can connect to it using this IP address. Humans lack the mental capacity to remember so many random strings of numbers which are essentially IP addresses. Humans can remember literature words that have some meaning. This came to be known as domains. Each computer that has an IP address also has an alias to this IP address known as a domain. Similar to IP addresses, this domain is also unique across the globe.


DNS (or Domain Name System) is used to translate this "readable name" or domain into IP addresses.


How does the Domain Name System (DNS) work?

There are 4 types of DNS servers involved in translating the domain name into an IP address.


4 Types of DNS Servers and What happens when an HTTPS request is made?


Steps involved in a DNS Lookup


Let's see what happens when you type a URL in your browser. For example, I will type - https://thegeekyminds.com in my browser.


  • DNS Recursor Resolver - My browser will first check in the operating system if it already knows the IP address corresponding to this URL. The IP address may be stored in the browser cache or somewhere on the computer. If the operating system knows the IP address, the search would end here. If the operating system does not know the IP address, it will ask the DNS Recursor Resolver for the IP address. The DNS Recursor Resolver may or may not have this IP address in memory. If the DNS Recursor Resolver does not have the IP address, it will direct the search to the Root Nameserver.

  • Root Nameserver - The root name server will reply that it knows where to find the IP Address and will direct the DNS Recursor Resolver to TLD nameservers. TLD stands for (Top Level Domain). The DNS Recursor Resolver will store all this information in its cache and go to the "COM" TLD name server.