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 is a DNS server as
well as explain how they work. A DNS, short for domain name system, is used
to resolve a particular domain name to its IP equivalent. Domain
names (e.g. keycdn.com) are simply used to be more easily read / remembered by
humans, however, all domain names are associated with a particular IP address.
This can be compared to a phone book 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
particular DNS hosting provider’s name servers 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 lookup a website’s IP.
- Website Request - The first step is, of course, to request the
actual website via a web browser. When someone types in a particular
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.
- 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.
- 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.
- 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.
- 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 particular domain.
- 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.
No comments:
Post a Comment