What Is DNS? - How DNS Works - Cloudflare
What Is DNS? - How DNS Works - Cloudflare
What Is DNS? - How DNS Works - Cloudflare
What is DNS?
What is DNS?
The Domain Name System (DNS) is the phonebook of the Internet. Humans
access information online through domain names, like nytimes.com or
espn.com. Web browsers interact through Internet Protocol (IP) addresses. DNS
translates domain names to 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).
:
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.
Report
2023 GigaOm Radar for DNS Security
Contact sales
• 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.
Log in
• 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”).
Put simply, an authoritative DNS server is a server that actually holds, and is
responsible for, DNS resource records. This is the server at the bottom of the
DNS lookup chain that will respond with the queried resource record, ultimately
allowing the web browser making the request to reach the IP address needed to
access a website or other web resources. An authoritative nameserver can
satisfy queries from its own data without needing to query another source, as it
is the final source of truth for certain DNS records.
It’s worth mentioning that in instances where the query is for a subdomain such
:
as foo.example.com or blog.cloudflare.com, an additional nameserver will be
added to the sequence after the authoritative nameserver, which is responsible
for storing the subdomain’s CNAME record.
There is a key difference between many DNS services and the one that
Cloudflare provides. Different DNS recursive resolvers such as Google DNS,
OpenDNS, and providers like Comcast all maintain data center installations of
DNS recursive resolvers. These resolvers allow for quick and easy queries
through optimized clusters of DNS-optimized computer systems, but they are
fundamentally different than the nameservers hosted by Cloudflare.
Note: Often DNS lookup information will be cached either locally inside the
querying computer or remotely in the DNS infrastructure. There are typically 8
steps in a DNS lookup. When DNS information is cached, steps are skipped from
the DNS lookup process which makes it quicker. The example below outlines all
8 steps when nothing is cached.
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.
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. When searching for example.com, our request
is pointed toward the .com TLD.
5. The TLD server then responds with the IP address of the domain’s
nameserver, example.com.
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 8 steps of the DNS lookup have returned the IP address for
example.com, the browser is able to make the request for the web page:
10. The server at that IP returns the webpage to be rendered in the browser
(step 10).
Note: A typical uncached DNS lookup will involve both recursive and iterative
queries.
2. 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.
3. 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.
Modern web browsers are designed by default to cache DNS records for a set
amount of time. The purpose here is obvious; the closer the DNS caching occurs
to the web browser, the fewer processing steps must be taken in order to check
the cache and make the correct requests to an IP address. When a request is
made for a DNS record, the browser cache is the first location checked for the
requested record.
In Chrome, you can see the status of your DNS cache by going to chrome://net-
internals/#dns.
When the recursive resolver inside the ISP receives a DNS query, like all
previous steps, it will also check to see if the requested host-to-IP-address
translation is already stored inside its local persistence layer.
The recursive resolver also has additional functionality depending on the types
of records it has in its cache:
1. If the resolver does not have the A records, but does have the NS records
for the authoritative nameservers, it will query those name servers directly,
bypassing several steps in the DNS query. This shortcut prevents lookups
from the root and .com nameservers (in our search for example.com) and
helps the resolution of the DNS query occur more quickly.
2. If the resolver does not have the NS records, it will send a query to the TLD
servers (.com in our case), skipping the root server.
3. In the unlikely event that the resolver does not have records pointing to the
TLD servers, it will then query the root servers. This event typically occurs
after a DNS cache has been purged.
Learn about what differentiates Cloudflare DNS from other DNS providers.
RELATED CONTENT
DNS security
DNS Zone
Reverse DNS
Email: *
Subscribe to theNET
The information you provide to Cloudflare is governed by the terms of our Privacy Policy.
Getting Started
Free plans
For enterprises
Compare plans
Get a recommendation
Request a demo
Contact sales
About DNS
DNS Servers
DNS Records
:
DNS Records
DNS Glossary
© 2024 Cloudflare, Inc. Privacy Policy Terms of Use Report Security Issues
Cookie Preferences Trademark
: