What is a DNS Server?
You may have come across the term “DNS
server” before but weren’t sure what it referred to. This article aims to
answer the question what a DNS server is as well as explain how they work. A
DNS, short for domain name system, is used to resolve a domain name to its IP
equivalent. Domain names (e.g. tezhost.com) are simply used to be more easily
read / remembered by humans, however, all domain names are associated with a IP
address. This can be compared to a phonebook where a person’s name would
correspond to the domain name (e.g. yourwebsite.com) and their phone number
would correspond to the website’s IP (e.g. 159.x.x.x).
These IP address lookups are performed
by DNS servers. A website address is
associated with a DNS hosting provider’s name server which are responsible for
resolving the IP address of said website. The actual process of how a DNS
server works is explained in greater detail in the section below
How Does a DNS Server Work?
You can perform a DNS lookup using a couple
of methods such as using dig example.com in the CLI or using a DNS lookup tool.
There are a few steps that take place when a DNS server is asked to look up a
website’s IP.
1.
Website Request - The first step is, of
course, to request the actual website via a web browser. When someone types in
a website’s address (e.g. keycdn.com) into their address bar, the DNS lookup
process begins. Both the OS and browser first look at their own DNS
caches to see if the information is already stored locally. If not,
the resolver must be asked.
2.
Ask resolver - Once the locally cached DNS records have been checked,
the OS asks the resolver. The resolver is usually your ISP (internet service
provider). It first checks its own cache to verify if the information is not
already stored locally. If it’s not, it goes on to ask the root server.
3.
Ask root server - The next step is to ask
the root server. The root server looks at the last section of the request (the
.com portion). Although the root server cannot locate the IP address of the
website, it tells the resolver where the top-level domain (TLD) servers are for
.com. The resolver then stores this information for later use.
4.
Ask TLD server - The resolver goes on to
ask the TLD servers the IP address of the website in question. Although the TLD
servers can’t provide us with the required information, they know where to
direct our request. The TLD servers provide the resolver with a list of name
servers for that website. Again, the resolver stores this information for later
use.
5.
Ask authoritative name servers - Finally, now that the
resolver knows what the authoritative name servers are, it can query these name
servers and retrieve the required IP information. The authoritative
name servers contain all the necessary information regarding a domain.
6.
Cache the IP and return it to the browser - Now that the
resolver knows the IP of said domain, it will cache it for later use. At this
point, the IP is delivered to your OS where it is locally cached as well. The
OS then passes this information on to the browser. Once the browser knows the
IP address of the website, it can then begin requesting and receiving
information from the website’s origin server
Choosing a DNS Hosting Provider
If you’re setting up a website, it is
important to choose a reliable DNS
hosting provider. A DNS hosting provider is responsible for providing the
authoritative name servers as mentioned in step 5. These name servers can
provide all necessary information regarding your website. Choosing a reliable
DNS hosting provider is important for a few reasons including:
Redundancy
Speed
Security
Setting up a backup DNS provider is
important to avoid downtime if your primary provider goes down. Redundancy will
help ensure that your website remains live, which is crucial for many online
businesses. Speed is also important as a good DNS provider will ensure that
latency between DNS lookups and TTFB is minimal. Lastly, if you have
implemented proper redundancy, this will also help increase security in the
event of a DDoS attack.
Comments
Post a Comment