What is DNS? A Complete Guide to How DNS Works

what-is-dns

The domain name system (DNS) is a crucial element to the function of browsing the web, yet few web users know how it works. If you’re looking to dive deeper into how web browsers are able to comb the vast array of documentation to serve the correct page to end users, this article’s for you. 

What is DNS?

The domain name system (DNS) is a universally recognized mechanism used to identify and locate all pages and content reachable through the web. It translates and connects a human readable URL to a machine readable format of numbers.

Though there are many web browsers, internet service providers (ISPs), domain registrars, and web hosts⁠—there is only one universal DNS. This is what makes it possible to serve the same webpage to users around the world, regardless of what variety of tools they’re using to access the internet. 

Find your perfect domain name.

Search for domain name ideas and instantly check domain availability.

Learn more

How does DNS work?

DNS locates and serves the web page you’re looking for in a matter of seconds through a rapid, complex series of internet protocols. It's like a phone book for the web.

DNS translates the URL you type into a web browser into a unique internet protocol (IP) address, similar to a phone number. Every single device connected to the internet, whether it’s being used to host websites or browse them, has an IP address.

The internet has two congruent but separate ways of identifying websites. The first is the domain name space (which identifies websites via their domain) and the second is the IP address system, which uses a unique set of numbers to identify devices connected to the internet. 

What is a DNS query?

A DNS query (or a DNS request) is a request for information sent from a user’s device (called the DNS client) to a DNS server. The most common type of DNS query is a request for the IP address associated with a specific domain. 

What is a DNS server?

A DNS server is a machine that converts domain names into IP addresses. The IP addresses direct web browsers to the server with the content requested by the user.

How do DNS servers work?

A DNS server works through a process called DNS resolution. A client issues a DNS query for what is known as an “A record” to map a domain name to a set of IP addresses and serve the correct webpage to users. 

There are four types of DNS servers involved in loading a webpage: a DNS recursor (also called a recursive resolver), root name servers, top-level domain (TLD) nameservers, and authoritative nameservers.

DNS Recursor

A DNS recursor (or recursive resolver) is the first step in a DNS query. Recursive resolvers can be thought of as the front-desk attendant of a large, archival warehouse. Resolvers receive DNS queries from your browser, and send their own DNS requests to a number of other servers to help locate the information you’re looking for. 

Root name server

The root name server is the first server the recursor queries during the DNS lookup process. A DNS root name server receives requests from a recursor and responds with a list of top-level domain (TLD) nameservers that contain the information the recursor is looking for. 

TLD name server

A TLD name server is responsible for maintaining information for all domains that share a common extension (such as .com or .net), known as a top-level domain. After receiving a response from the root name server, the DNS recursor queries the appropriate TLD name server, which responds with the appropriate authoritative name server. 

Authoritative name server

An authoritative name server is able to provide an answer to the query originally asked by the DNS recursor. The authoritative name server replies back with either the IP address of the webpage or an error message if it’s unable to find it.

Once the resolver has a corresponding IP address for the requested webpage, it’s able to send the information to the web browser, which is then able to display the requested web page. 

What is the difference between a DNS and an IP address?

A DNS translates the domain name requested by a user into an IP address. The IP address is the numeric location of the files that belong to that domain. 

What is DNS caching? 

DNS caching is a process wherein a DNS client stores DNS records locally. The client is typically an operating system or web browser.  Caching lets clients produce information about a webpage associated with a given domain name without having to perform a DNS query. 

The domain name system also implements a time-to-live (or TTL) on all DNS records, which specifies how much time a record can be cached. The TTL value gets stored during the caching process, making it so the record is deleted from the cache after a specific amount of time. 

What are the types of DNS queries? 

There are three types of DNS queries: recursive, iterative, and non-recursive.

Recursive query

In a recursive query, a DNS client provides a hostname and requires that the recursive DNS server (DNS resolver) responds with either the correct resource records or an error message saying the records could not be retrieved.

Iterative query

In an iterative query, a DNS client provides a hostname and allows the DNS resolver to return the best answer it can. The DNS resolver may respond by returning the cached DNS records (if it has them) or by referring the DNS client to the root server or an authoritative DNS server nearest to the required DNS zone. 

The recursor then queries the provided DNS name servers for a match. This process continues down the server chain of command until an answer, error, or timeout occurs. 

Non-recursive query

In this type of query, the DNS resolver is able to provide an answer right away, either because it's authoritative for the record, or because it has the record stored in its cache. In non-recursive queries, there is no need for additional queries, since a response can be returned immediately. 

What is a CNAME record?

A canonical name (CNAME) record is used in the DNS lookup process for creating an alias from one domain name to another.

For example, a DNS client trying to resolve the subdomain name www.example.com would be referred to the root domain (in this case, example.com) by a CNAME record. 

CNAME records are commonly used for:

  • Redirecting users from owned domains to the primary website. For example, typing the URL gogle.com will redirect users to google.com, despite the spelling error.
  • Providing separate hostnames for specific network services running on different ports. For example, allowing a file transfer protocol (FTP) server and a web server to run on different ports from the same IP address.
  • Registering localized domains and pointing them to a primary website. For example, if your primary website was hosted at example.com and you wanted to redirect users from example.ca, example.co.uk, and example.us to the same website.

The DNS is an essential part of browsing the internet

Browsing the internet wouldn’t be possible without the domain name system (DNS). The universal nature of the DNS makes it possible for browsers to comb the incalculable well of documentation online and serve the correct page to users in a period of time often shorter than a second.

Learn more about domains: 

What is DNS FAQ

What does DNS stand for?

DNS stands for domain name system.

What is DNS and why is it used?

The DNS is a universally recognized naming system used for turning domain names (which are easily read by humans) into IP addresses (which are easily read by computers), allowing different browsers to load the same DNS information when visiting the same webpage.

What is the difference between DNS and IP?

While both the DNS and IP addresses play a role in the DNS lookup process, they perform very different functions. The DNS is a universally recognized tool for matching domain names with computer-readable IP addresses. It helps to think of the DNS as being a phone book, where domain names are a common or given name and IP addresses are phone numbers.

What is a nameserver?

A nameserver is the server component of the DNS, responsible for translating human-readable domain names and hostnames into computer-readable IP addresses during the DNS resolution process.

What is a DNS server?

DNS servers (synonymous with nameserver) are servers responsible for translating hostnames into IP addresses during the DNS resolution process. Four types of DNS servers are used during a DNS lookup: a DNS recursor, root name servers, TLD nameservers, and authoritative nameservers.

Topics: