What Is DNS: A Comprehensive Guide for Beginners

As a website owner, there are certain terms and technologies you need to understand, and DNS is one of them. It’s the system that allows your browser to locate and load the correct website when you type a domain name into the address bar.

If you already have a website, chances are you’ve configured some DNS records. Maybe you’ve added an A record, tweaked a CNAME, or set up MX records for email. But how does DNS actually work? Why is it important? And what should you know to manage it properly? In this guide, we’ll answer all of these questions and more. By the end, expect to have a thorough understanding of DNS and everything it represents.



What does DNS stand for and why is it important?

The internet is a massive network of interconnected computers. Each of these computers, whether it’s a cloud server hosting a website or your own laptop, has a unique identifier called an IP address. Think of it as a home address for computers that allows them to find and communicate with each other. 

An IP address looks something like this: 170.168.19.123.

Every website you visit is hosted on a computer somewhere in the world. This means that to visit a website, you’d technically have to enter its IP address. But let’s be honest—how many of us could remember something like 172.217.10.46 just to visit Google?

This is exactly the problem the early designers of the internet foresaw. To make all our lives easier, they introduced the concept of domain names. These are human-friendly addresses like google.com or yourwebsite.com that we can enter in our browser tabs to visit our favorite sites. 

These domain names are linked to IP addresses, and the data is stored in a distributed database across many servers worldwide. Whenever you enter a website’s name in your browser, the Domain Name System (DNS) translates that name into its corresponding IP address. This allows your browser to connect to the precise computer where the website is hosted.

Imagine if your phone didn’t have a contact list and you had to remember everyone’s phone number. That’s what the internet would be like without DNS! 

Why is DNS important?

In addition to making the internet easier to use, DNS plays many other roles, such as:

  • Speed and efficiency: DNS servers make websites load faster by directing traffic through the best available routes.
  • Redundancy and reliability: The DNS system is spread across multiple servers worldwide. This reduces the risk of a single point of failure.
  • Security: Some DNS services can even filter and block malicious websites and phishing attempts.
  • Custom configurations: Website owners can configure DNS settings to manage email services, subdomains, load balancing, and much more.

Different types of DNS servers 

Next, let’s explore the different types of DNS servers.

Recursive resolver

This is the first server that handles a DNS query. It searches for the IP address by querying other DNS servers, if needed. ISPs and public DNS providers (like Google and Cloudflare) operate these resolvers.

Root name server

These are the highest-level DNS servers that direct queries to the correct TLD (Top-Level Domain) servers. There are many root servers present worldwide, operated by different organizations. However, only 13 IP addresses are used to query them due to limitations in the original DNS architecture.

TLD name server

These servers manage domain extensions like .com, .org, .net, and country-specific TLDs (.ng, .za). They point queries to the correct authoritative name servers for the requested domain.

Authoritative name server

This is the final stop in a DNS query. It stores the actual DNS records for a domain and returns the correct IP address or other DNS information. 


How does DNS work?

Before you can access a website using a domain name, the domain must be registered with a domain registrar. It’s during the domain registration process that the website owner links the domain to the IP address of the server where the website is hosted. This mapping is stored in DNS records, which are maintained by authoritative DNS servers.

But what happens behind the scenes when you enter a domain like google.com in your browser? Let’s discuss:

Step-by-step process of DNS resolution

  1. You enter a website’s domain in the address bar and hit Enter.
  2. Your browser first checks if it has recently looked up the domain. If the IP address is stored in its cache, it uses that information and skips the lookup process.
  3. If the IP isn’t cached, the browser sends a query request to a DNS resolver (usually provided by your ISP or a public DNS service like Google DNS). The resolver acts as a middleman between your device and the DNS system.
  4. The resolver checks its local cache to see if it has a recent record of the domain’s IP. If it gets a hit, it returns the IP address to your device. If not, it moves onto the next step.
  5. The resolver sends the request to one of the root DNS servers. These servers don’t store the actual domain-to-IP mappings but instead direct the request to the appropriate Top-Level Domain (TLD) server, depending on the domain extension (.com, .org, .net, etc.). 
  6. The TLD server doesn’t have the exact IP either, but it knows which authoritative DNS server holds the final answer. So, it directs the resolver to that specific authoritative DNS server.
  7. The request finally reaches the authoritative DNS server responsible for the specific domain. This server contains the actual DNS records and returns the correct IP address to the resolver.
  8. Once the resolver gets the IP address, it passes it back to your browser, which then connects to the website’s server and loads the page.
  9. To speed up future lookups, the resolved IP address is cached by your browser and the DNS resolver for a set period.

This whole process completes in milliseconds so you don’t notice the complex behind-the-scenes communication that makes the internet tick!


Different types of DNS records

Here are the most common types of DNS records:

  • A record: Maps a domain to an IPv4 address (e.g., mysite.com → 49.56.229.122).
  • AAAA record: Similar to an A record but maps a domain to an IPv6 address.
  • CNAME record: Maps a domain name to another domain name (e.g., www.example.com → example.com).
  • MX record: Directs email to the correct mail server for the domain.
  • TXT record:  Stores text-based information for verification, security, or authentication purposes.
  • NS record: Defines which authoritative name servers handle DNS queries for the domain.
  • PTR record: Used for reverse DNS lookups. Maps an IP address to a domain name (the reverse of an A or AAAA record).
  • SRV record: Determines the location of specific services, such as VoIP or messaging servers.
  • SOA record: Provides administrative information about the domain’s DNS, including the primary name server and refresh intervals.

How to check and manage your DNS settings

Here’s a quick guide on how you can personally check and manage your DNS configurations:

How do I find my DNS server?

Use these methods to check which DNS server your computer is using:

On Windows

  1. Press Win + R, type cmd, and hit Enter. This will open the command prompt.
  2. Run the following command:

ipconfig /all

  1. Look for the DNS Servers entry under your active network connection. For example:
an Ethernet adapter configuration displayed in a command prompt window, showing network details such as IP address (192.168.100.55), subnet mask, default gateway, DHCP server, and DNS server settings.

On Mac

  1. Open Terminal (Applications → Utilities → Terminal).
  2. Run the command:

scutil –dns | grep ‘nameserver’

  1. This will list the DNS servers your Mac is using.

On Linux

  1. Open a terminal.
  2. Run the command:

cat /etc/resolv.conf

  1. You’ll see the DNS servers listed under nameserver. For example:
A screenshot of a configuration file generated by NetworkManager, showing a nameserver entry set to 192.168.100.1.

How do I check my DNS settings?

If you want to check your DNS settings, here are different command-line tools and online services that you can use:

nslookup (Windows, Mac, Linux)

The nslookup command retrieves DNS records for a domain. For example, to check the IP address of google.com:

nslookup example.com

A screenshot of a command-line DNS query result showing the resolution of "example.com" to multiple IPv4 and IPv6 addresses, with the DNS server set to 192.168.100.1.

dig (Mac, Linux)

The dig command provides detailed DNS information. Run:

dig example.com

Expect an output like:

; <<>> DiG 9.16.23-RH <<>> example.com

;; global options: +cmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7791

;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:

; EDNS: version: 0, flags:; udp: 1232

;; QUESTION SECTION:

;example.com. IN A

;; ANSWER SECTION:

example.com. 218 IN A 23.192.228.80

example.com. 218 IN A 96.7.128.198

example.com. 218 IN A 96.7.128.175

example.com. 218 IN A 23.215.0.138

example.com. 218 IN A 23.215.0.136

example.com. 218 IN A 23.192.228.84

;; Query time: 9 msec

;; SERVER: 192.168.100.1#53(192.168.100.1)

;; WHEN: Wed Feb 26 10:57:42 EST 2025

;; MSG SIZE  rcvd: 136

To check a specific record type (like MX records for email), use:

dig example.com MX

whois

The whois command can show DNS registrar details and nameservers:

whois example.com

A WHOIS lookup result for the domain "EXAMPLE.COM," displaying information such as the registrar, registration and expiry dates, name servers, domain status codes, and DNSSEC details.

Using online tools

If you prefer not to use the command line, you can use online tools like:

  • IntoDNS: Checks DNS configuration and reports errors.
  • MXToolbox: Checks various DNS records, including MX and SPF records.
  • Google Admin Toolbox: Provides various DNS lookup tools.

How to flush DNS cache (clear old records)

DNS caching speeds up browsing by storing previously resolved domain names. However, sometimes outdated or incorrect records get stuck in the cache, leading to issues. In such cases, flushing your DNS cache can help as it forces your system to fetch fresh DNS data. 

Why flush?

There are many scenarios in which a flush can help. For example:

  • Fixing website loading issues: If a website has changed servers and your computer still has the old IP address cached, you may see a “page not found” error, or a completely different website.
  • Resolving DNS errors: Issues like DNS_PROBE_FINISHED_NXDOMAIN can sometimes be fixed by clearing the cache.
  • Refreshing network settings: If you’ve changed DNS servers (e.g., switching to Google DNS or Cloudflare DNS), clear the cache to immediately use the new settings.
  • Improving security: A flush removes potentially malicious or incorrect DNS records injected by malware or other targeted attacks. (Read this short guide on how to enhance your server’s security and prevent such threats.

How to flush DNS on Windows, Mac, and Linux

Here’s how you can flush your DNS on different operating systems:

On Windows

  1. Press Win + R, type cmd, and hit Enter. This will open the command prompt.
  2. Run the following command:

ipconfig /flushdns

  1. You should see a message saying Successfully flushed the DNS Resolver Cache.
A Windows Command Prompt where the command ipconfig /flushdns has been executed. The system successfully flushed the DNS Resolver Cache, confirming the operation was completed.

On Mac

  1. Open Terminal (Applications → Utilities → Terminal).
  2. Depending on your Mac version, you will have to run a different command. For example:

For macOS 12 (Monterey), run:

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

For macOS 10.12 (Sierra), run:

sudo killall -HUP mDNSResponder

For OS X 10.9 (Mavericks), run:

sudo killall -HUP mDNSResponder

Enter your admin password if prompted, then press Enter.

On Linux

  1. Open a terminal.
  2. Run the command:

sudo resolvectl flush-caches

How long does DNS cache last?

The Time to Live (TTL) value set within the website’s DNS configuration determines how long a DNS record stays stored in a cache before it expires and must be refreshed from the authoritative server. Here are some key points in this regard:

  • The TTL can range from seconds to hours (e.g., 300 seconds = 5 minutes, 3600 seconds = 1 hour).
  • An ideal TTL value is one that balances speed and reliability. For most websites, a TTL of 300 to 3600 seconds (5 minutes to 1 hour) works well.
  • Some ISPs may override TTL settings and cache records longer than intended.
  • A DNS cache flush does not change TTL values. It only forces a fresh lookup.

Conclusion

Now you know that DNS is what translates domain names into IP addresses, helping your browser connect to websites. If you own a website, make sure you configure your DNS records correctly to keep it accessible and running smoothly. 

Don’t have a domain yet? Visit us to register your domain name today!

Articles you may enjoy

Looking for further info, or perhaps a how-to guide?