Beginner 8 min read Updated: Aug 22, 2026

What Is DNS?

Learn how the Domain Name System works.

The Domain Name System (DNS) is fundamentally the phonebook of the internet. Humans access information online through domain names like google.com or mjtechhub.site. Web browsers, however, interact through Internet Protocol (IP) addresses. DNS translates these human-readable domain names into machine-readable IP addresses so browsers can load internet resources.

Each device connected to the internet has a unique IP address which other machines use to find the device. DNS servers eliminate the need for humans to memorize IP addresses such as 192.168.1.1 (in IPv4) or more complex newer alphanumeric IP addresses such as 2400:cb00:2048:1::c629:d7a2 (in IPv6).

Why is DNS Used?

Without DNS, navigating the web would be incredibly tedious. You would have to memorize a string of numbers for every single website you want to visit. Furthermore, websites frequently change their IP addresses (due to load balancing, migrations, or changing hosting providers). If a website changes its IP address, DNS handles the update seamlessly behind the scenes, ensuring the domain name still points to the correct new IP address without any disruption to the user.

How Does DNS Work? (The Lookup Flow)

When you type a web address into your browser, a complex but incredibly fast process occurs. Here is a simplified breakdown of the DNS lookup flow:

  1. The DNS Query: You type example.com into your web browser. Your computer first checks its local DNS cache to see if it already knows the IP address. If not, it sends a query to a DNS Resolver.
  2. The DNS Resolver (Recursive Resolver): This is usually provided by your Internet Service Provider (ISP) or a third-party like Google (8.8.8.8). The resolver checks its own cache. If the IP isn't there, it starts the hunt.
  3. The Root Nameserver: The resolver asks the Root Nameserver. The Root Nameserver doesn't know the IP, but it knows where to find the server responsible for the Top-Level Domain (TLD) like .com or .net.
  4. The TLD Nameserver: The resolver then asks the TLD Nameserver for .com. The TLD server knows the Authoritative Nameserver for example.com and points the resolver there.
  5. The Authoritative Nameserver: Finally, the resolver queries the Authoritative Nameserver for example.com. This server holds the actual DNS records. It returns the exact IP address to the resolver.
  6. Connection Established: The resolver gives the IP address back to your computer (and caches it for future use). Your web browser now connects to the IP address and loads the website.

Basic DNS Record Types

DNS isn't just for websites; it handles email, text verification, and more using different record types. To learn about all the records in depth, you can read our DNS Record Types Explained tutorial. Here are the fundamental ones:

  • A Record (Address Record): Maps a domain name (like example.com) to an IPv4 address (like 198.51.100.10). This is the most common record.
  • AAAA Record (Quad-A Record): Similar to the A record, but it maps the domain to an IPv6 address.
  • CNAME Record (Canonical Name): Aliases one domain name to another domain name. For example, www.example.com might be a CNAME pointing to example.com.
  • MX Record (Mail Exchange): Directs email to a mail server. It tells the internet where to deliver emails sent to your domain.
  • NS Record (Name Server): Indicates which DNS servers are authoritative for a domain.
  • TXT Record (Text Record): Originally for human-readable text, but now heavily used for domain verification, SPF, and DKIM email security.

Simple Real-World Example

Imagine you want to call a business named "Tech Supplies Inc." You don't know their phone number, so you open the contact directory on your phone (Local Cache). If you don't have it saved, you call the operator (DNS Resolver). The operator doesn't know the exact number but knows the directory for businesses in that city (TLD Nameserver). The city directory tells the operator to check the specific office directory (Authoritative Nameserver). The office directory provides the exact phone number (IP address). The operator gives you the number, and you make the call.

Common Commands and Tools

Network administrators frequently use command-line tools to query DNS servers and troubleshoot issues.

nslookup (Windows / Linux)

nslookup is a built-in tool used to query DNS to find IP addresses or specific DNS records.

> nslookup example.com
Server: dns.google
Address: 8.8.8.8

Non-authoritative answer:
Name: example.com
Address: 93.184.216.34

dig (Linux / macOS)

dig (Domain Information Groper) is a more flexible and detailed tool heavily favored by network and systems administrators.

$ dig example.com +short
93.184.216.34

Common DNS Problems and Troubleshooting

DNS is often the hidden culprit behind network connectivity issues. A classic IT joke is: "It's always DNS."

1. The Site Can't Be Reached (But Ping Works)

If you can ping 8.8.8.8 successfully (meaning you have internet access), but navigating to a website fails, your DNS resolver is likely failing.

Troubleshooting Step: Try manually changing your computer's DNS settings to a public resolver like Google (8.8.8.8) or Cloudflare (1.1.1.1).

2. Cached Outdated Information

If a website recently changed its server (IP address), your local computer or ISP resolver might still have the old IP cached. This results in loading an old version of the site or getting an error.

Troubleshooting Step: On Windows, open Command Prompt and run ipconfig /flushdns to clear your local cache. If the issue persists, the ISP resolver might still be caching it (which just requires waiting for the TTL to expire).

3. Authoritative DNS Misconfiguration

If you are managing a domain and the website is down globally, the Authoritative Nameservers might have incorrect A records or missing NS records.

Troubleshooting Step: Use a tool like dig or online propagation checkers to verify what records the authoritative servers are actually broadcasting to the world.

For more detailed troubleshooting workflows, refer to the DNS Troubleshooting Guide and Advanced DNS Troubleshooting.

Quick Summary

  • DNS acts as the internet's phonebook, turning domain names into IP addresses.
  • The process involves a Resolver, Root servers, TLD servers, and Authoritative servers.
  • DNS caching speeds up future lookups.
  • If you can reach an IP but not a domain, you have a DNS problem.
  • Common tools include nslookup and dig.
Code copied to clipboard!