CODING OMEGA

From beginner-friendly tutorials to advanced programming concepts, our blog is your go-to resource for all things code-related.

DNS and DNS Lookup Explained

September 11, 2025

CS fundamentals

dns-lookup-explained

In this article, I am going to explain what is DNS for beginners, how does DNS lookup works and different types of DNS records.

What is DNS and How Does DNS Loopkup Work?

Imagine you want to visit a friend's house. You know their name (like google.com), but you need their street address (like 142.250.191.14) to get there. The Domain Name System (DNS) is like a giant address book that translates those easy-to-remember names into the numeric addresses that computers use to find each other on the internet.

In other words, DNS, or the Domain Name System, translates human readable domain names (for example, www.google.com) to machine readable IP addresses (for example, 192.0.2.78).

Let's break down the practical steps of what happens when you type a website name into your browser.

How Does DNS Lookup Work

  1. The Local Cache Check

First, your computer or your web browser will check its own memory, or cache, to see if it has recently looked up the address for that website. If it finds it, great! It uses that address and the process is over. This is the fastest way to get to a website.

  1. The Request to Your ISP

If the address isn't in your cache, your computer sends a request to a recursive DNS server, which is usually managed by your Internet Service Provider (ISP). This server is the first stop in the search, and its main job is to find the correct address for you.

  1. The Root and TLD Servers

The ISP's DNS server doesn't have all the addresses in the world. So, it starts a journey up the DNS hierarchy.

It first asks a root DNS server for directions. The root server is at the top of the DNS tree, but it doesn't know the full address. It simply points the ISP's server to the next step, which is the Top-Level Domain (TLD) server. TLDs are things like .com, .org, or .net.

The ISP's server then goes to the appropriate TLD server. The TLD server also doesn't know the final address, but it knows which server is in charge of the specific domain you're looking for, such as google.com. It points the ISP's server to that server.

  1. The Authoritative Name Server

The last stop is the authoritative name server. This is the official server that knows the exact and final address for google.com. It's like the main office for that website. It gives the IP address—142.250.191.14 in this case—back to your ISP's server.

  1. Getting to the Website

Your ISP's server now has the IP address and sends it back to your computer. Your computer stores it in its cache for a short period of time and then uses that IP address to connect directly to the Google server and load the webpage.

This entire process, from typing the domain name to the webpage loading, happens in the blink of an eye. The DNS system is what makes it all possible, acting as the internet's phone book to make our online lives so much easier.

Why Does This Matter?

Understanding DNS can help you troubleshoot common internet issues. For example:

  • Website is down

If a specific website isn't working for you, you can try using a different DNS server, like one from Google (8.8.8.8) or Cloudflare (1.1.1.1), to see if the problem is with your ISP's DNS.

  • Slow browsing

A slow or overloaded DNS server can delay the lookup process and make websites feel slow to load.

  • DNS poisoning

Malicious actors can "poison" a DNS cache, causing a domain name to point to a fake or malicious website.

Different Types of DNS Records

DNS records are like different types of entries in a phone book, each with a specific purpose. They tell servers how to handle a domain, from where to find its website to where to send its email. Here are some of the most common types:

  • A and AAAA Records

These are the most fundamental records. An A (Address) record maps a domain name to an IPv4 address (e.g., 192.0.2.1). An AAAA record does the same thing but for an IPv6 address (e.g., 2001:0db8::8a2e:0370:7334). A domain can have both an A and an AAAA record, allowing it to be accessed using either type of IP address.

  • CNAME Records

A CNAME (Canonical Name) record creates an alias for a domain. It points one domain or subdomain to another domain, not to an IP address. For example, you might create a CNAME record so that www.example.com points to example.com. This is useful because if you ever need to change the IP address, you only have to update the A record for example.com and all the CNAME records pointing to it will automatically update.

  • MX Records

An MX (Mail Exchange) record specifies the mail server responsible for accepting email messages for a domain. When you send an email to name@example.com, your email client performs a DNS query to find the MX record for example.com. The MX record then directs the email to the correct mail server. A domain can have multiple MX records, each with a different priority number, to ensure email delivery even if one server is unavailable.

  • TXT Records

A TXT (Text) record is a versatile record that allows domain administrators to store human-readable text information in their DNS. While they were originally used for notes, their modern use is primarily for security purposes, especially for email. For example, SPF (Sender Policy Framework) and DMARC (Domain-based Message Authentication, Reporting, and Conformance) records use TXT records to prevent email spoofing and phishing by verifying that an email came from a trusted source.

  • NS and PTR Records

An NS (Name Server) record identifies the authoritative name servers for a domain. These are the servers that hold all the DNS records for that domain. Think of the NS record as the official directory that tells other DNS servers where to go to get the definitive list of records for a particular domain.

A PTR (Pointer) record is the inverse of an A record. It performs a reverse DNS lookup, mapping an IP address back to its corresponding domain name. This is often used for email validation and is a key part of ensuring an email server is legitimate.

I hope this article gives you good enough understanding of DNS, DNS lookup and types of records. You can further read more about it like DNS security, TTL (Time-to-Live), DNS Propagation etc.

dns dns lookup dns records

Back to home