1. WebsitePlanet
  2. >
  3. Glossary
  4. >
  5. Web hosting
  6. >
  7. What is DNS?

What is DNS?

Miguel Amado Written by:
Christine Hoang Reviewed by: Christine Hoang
06 November 2024
DNS, short for Domain Name System, is the internet’s equivalent of a phone book. It translates human-friendly domain names like “www.example.com” into machine-readable IP addresses such as “192.168.1.1”. Without DNS, you would need to memorize long strings of numbers to visit websites, making the internet much less user-friendly. This system is a fundamental component of how the internet works, seamlessly directing network traffic to the right places.

Definition of DNS

At its core, DNS is a hierarchical and decentralized naming system for computers, services, or any resource connected to the internet or a private network. It associates various information with domain names assigned to each participating entity.

Most prominently, DNS translates easily memorized domain names to the numerical IP addresses needed for locating and identifying computer services and devices with the underlying network protocols.

How Does DNS Work?

The process of DNS resolution involves converting a hostname (such as www.example.com) into a computer-friendly IP address (such as 192.168.1.1). An IP address is given to each device on the internet, and that address is necessary to find the appropriate internet device – like a street address is used to find a particular home. When a user wants to load a webpage, a translation must occur between what a user types into their web browser (example.com) and the machine-friendly address necessary to locate the example.com webpage.

In order to understand the process behind the DNS resolution, it’s important to learn about the different hardware components a DNS query must pass between. For the web browser, the DNS lookup occurs “behind the scenes” and requires no interaction from the user’s computer apart from the initial request.

Step 1: The DNS Recursor

The DNS recursor can be thought of as a librarian who is asked to go find a particular book somewhere in a library. The DNS recursor is a server designed to receive queries from client machines through applications such as web browsers. Typically the recursor is then responsible for making additional requests in order to satisfy the client’s DNS query.

Step 2: The Root Nameserver

The root server is the first step in translating (resolving) human readable host names into IP addresses. It can be thought of like an index in a library that points to different racks of books – typically it serves as a reference to other more specific locations.

Step 3: The TLD Nameserver

The top level domain server (TLD) can be thought of as a specific rack of books in a library. This nameserver is the next step in the search for a specific IP address, and it hosts the last portion of a hostname (in example.com, the TLD server is “com”).

Step 4: The Authoritative Nameserver

This final nameserver can be thought of as a dictionary on a rack of books, in which a specific name can be translated into its definition. The authoritative nameserver is the last stop in the nameserver query. If the authoritative name server has access to the requested record, it will return the IP address for the requested hostname back to the DNS Recursor (the librarian) that made the initial request.

Types of DNS Servers

To fully comprehend how DNS works, you need to understand the different types of DNS servers involved in the process. Each server performs a specific function in the DNS lookup chain.

Recursive Resolver

A recursive resolver (also known as a DNS recursor) is the first stop in a DNS query. The recursive resolver acts as a middleman between a client and a DNS nameserver. After receiving a DNS query from a web client, a recursive resolver will either respond with cached data, or send a request to a root nameserver, followed by another request to a TLD nameserver, and then one last request to an authoritative nameserver. After receiving a response from the authoritative nameserver containing the requested IP address, the recursive resolver then sends a response to the client.

Root Nameserver

The root server is the first step in translating domain names to IP addresses. It serves as a reference to other more specific locations in the DNS hierarchy.

TLD Nameserver

A TLD nameserver maintains information for all the domain names that share a common domain extension, such as .com, .net, or whatever comes after the last dot in a URL.

Authoritative Nameserver

An authoritative nameserver is the final stop in the DNS lookup process. It holds the actual IP address for a domain name. The authoritative nameserver responds to recursive resolvers with either the requested resource record or an error message if the record doesn’t exist.

DNS Caching

Caching plays a significant role in making the DNS infrastructure fast and scalable. DNS data can be cached at various levels – by recursive resolvers, by individual applications on user’s devices, and even by web browsers.

Recursive resolvers cache DNS records to prevent duplicating queries for commonly requested domain names. Such local caching helps to reduce DNS lookup latency and saves bandwidth. DNS caching not only enhances performance, but also allows DNS servers to handle high loads efficiently.

Web browsers also maintain an internal DNS cache to speed up repeated requests to the same domains. These browser-specific caches have a limited time-to-live (TTL) and are purged periodically to ensure the freshness of DNS data.

DNS Security

While DNS is a critical component of the internet infrastructure, it’s not without vulnerabilities. DNS was designed in the early days of the internet and lacked built-in security mechanisms. Over the years, certain vulnerabilities have been exploited, prompting the development of security extensions and best practices.

DNS Security Extensions (DNSSEC)

DNSSEC is a suite of extensions that add security to the DNS protocol. It provides cryptographic authentication of DNS data, ensuring that responses come from authoritative sources and haven’t been tampered with in transit. DNSSEC uses digital signatures to establish a chain of trust from the root zone down to individual domain names.

DNS over HTTPS (DoH) and DNS over TLS (DoT)

DoH and DoT are protocols designed to encrypt DNS queries and responses, protecting them from eavesdropping and manipulation. These protocols use HTTPS and TLS respectively to provide a secure channel between DNS clients and resolvers. Encrypting DNS traffic helps to maintain user privacy and prevents certain types of attacks, such as DNS spoofing.

Best Practices for DNS Security

Apart from implementing DNSSEC, DoH, and DoT, there are several best practices that organizations can follow to enhance their DNS security posture:

  1. Regularly update DNS software and apply security patches.
  2. Implement access controls and secure configurations on DNS servers.
  3. Monitor DNS traffic for anomalies and potential attacks.
  4. Use multiple DNS service providers for redundancy and resilience.
  5. Educate users about DNS-related threats and phishing.

Common DNS Queries

There are several common DNS query types that you might encounter:

Recursive Query

In a recursive query, a DNS client requires that a DNS server (typically a recursive resolver) will respond to the client with either the requested resource record or an error message if the resolver can’t find the record.

Iterative Query

In this situation, the DNS client will allow a DNS server to return the best answer it can. If the queried DNS server does not have a match for the query name, it will return a referral to a DNS server authoritative for a lower level of the domain namespace. The DNS client will then make a query to the referral address. This process continues with additional DNS servers down the query chain until either an error or timeout occurs.

Non-Recursive Query

Typically this will occur when a DNS resolver client queries a DNS server for a record that it has access to either because it’s authoritative for the record or the record exists inside of its cache. Typically, a DNS server will cache DNS records to prevent additional bandwidth consumption and load on upstream servers.

DNS Lookup Process

Now that you’ve seen all the components of a DNS query, let’s put it all together and look at the full DNS lookup process:

  1. A user types ‘example.com’ into a web browser and the query travels into the internet and is received by a DNS recursive resolver.
  2. The resolver then queries a DNS root nameserver.
  3. The root server then responds to the resolver with the address of a Top Level Domain (TLD) DNS server (such as .com or .net), which stores the information for its domains.
  4. The resolver then makes a request to the .com TLD.
  5. The TLD server then responds with the IP address of the domain’s nameserver, example.com.
  6. Lastly, the recursive resolver sends a query to the domain’s nameserver.
  7. The IP address for example.com is then returned to the resolver from the nameserver.
  8. The DNS resolver then responds to the web browser with the IP address of the domain requested initially.
Once the IP address is received by the web browser, it can then make a HTTP request to the IP which will return the web page to be rendered in the browser.

DNS Record Types

DNS records are instructions that live in authoritative DNS servers and provide information about a domain including what IP address is associated with that domain and how to handle requests for that domain. These records consist of a series of text files written in what is known as DNS syntax. There are many types of DNS records, but I’ll focus on the most common ones:

A Record

The ‘A’ stands for ‘address’ and this is the most fundamental type of DNS record. The A record is used by a computer to translate the name of the domain to an IP address. For example, if you pull the A record of Google you’ll find the IP address “172.217.5.78”.

AAAA Record

The AAAA record is very similar to the A record but is used for IPv6 addresses instead of IPv4. So if a domain has both an A record and an AAAA record, their DNS will work on both IPv4 and IPv6 networks.

CNAME Record

The ‘canonical name’ (CNAME) record is used in lieu of an A record, when a domain or subdomain is an alias of another domain. All CNAME records must point to a domain, never to an IP address. Imagine a scavenger hunt where each clue points to another clue, and the final clue points to the treasure. A domain with a CNAME record is like a clue that can point you to another clue (another domain with a CNAME) or to the treasure (a domain with an A record).

MX Record

The ‘mail exchanger’ (MX) record specifies the mail server responsible for accepting email on behalf of a domain name. It allows you to have a different mail server than your web server, so your email and web hosting can be separate. Like a CNAME, the MX record must always point to another domain.

TXT Record

A ‘text’ (TXT) record lets an admin store text notes in the record. These records are often used for email security. An email sender can say “Hey, if I’m sending email from this domain, the TXT record should have this SPF record”. Then the email recipient can say “Let me check the SPF records in the TXT entry for that domain and see if they match up”. This creates a layer of security to help prevent fraud.

Summary

DNS is a critical component of the internet infrastructure that translates human-friendly domain names into IP addresses that computers can understand. It works through a hierarchical system of nameservers, starting from the root and followed by TLD and authoritative nameservers. When a user enters a URL into a web browser, a DNS query is initiated, traversing this hierarchy to obtain the corresponding IP address.

DNS also incorporates caching mechanisms to enhance performance and reduce network load. However, DNS was not originally designed with security in mind, leading to the development of extensions like DNSSEC, DoH, and DoT to address vulnerabilities. Understanding how DNS works, its different components, and the lookup process is essential for anyone involved in web development, network administration, or cybersecurity. By grasping these concepts, you can optimize your applications, troubleshoot network issues, and implement best practices to secure your DNS infrastructure.

Rate this Article
5.0 Voted by 3 users
You already voted! Undo
This field is required Maximal length of comment is equal 80000 chars Minimal length of comment is equal 10 chars
Related posts
Show more related posts
We check all user comments within 48 hours to make sure they are from real people like you. We're glad you found this article useful - we would appreciate it if you let more people know about it.
Popup final window
Share this blog post with friends and co-workers right now:
1 1 1

We check all comments within 48 hours to make sure they're from real users like you. In the meantime, you can share your comment with others to let more people know what you think.

Once a month you will receive interesting, insightful tips, tricks, and advice to improve your website performance and reach your digital marketing goals!

So happy you liked it!

Share it with your friends!

1 1 1

Or review us on 1

3455617
50
5000
114309979