What is Domain Name System or DNS?
A Domain Name System (DNS) first emerged in the early 1980s. It represents a system of interconnected servers that store registered domain names and Internet Protocol (IP) addresses.
As the Internet grew, it became an unavoidable part of online interaction. The majority of internet users are not even aware of DNS and the huge favor it does us. Without DNS, you cannot access any website by typing a URL in your browser.
Computers talk to each other using IP addresses. Since humans cannot memorize thousands of strings of numbers, we have to use domain names instead of IP addresses. It is much easier to remember to type
phoenixnap.com into your browser than 188.8.131.52.
When you want to visit a website, your computer needs to know the exact IP address; it does not care about the domain name.
DNS keeps the record of all domain names and the associated IP addresses. When you type in a URL in your browser, DNS resolves the domain name into an IP address.
In other words, DNS is a service that maps domain names to corresponding IP addresses.
How Does DNS Work?
DNS is at the core of the Internet we use today.
The latest report shows there were 342.4 million domain names in the third quarter of 2018 and we would have been lost without DNS to resolve them into IP address.
When you want to call someone using your cell phone, it is highly unlikely you punch in the exact phone number. Instead, you load the contact list and search using the person’s name. DNS does the same thing when you want to load a website.
Resolving a domain name or a hostname goes through several different phases.
On some occasions, DNS resolving is a one-step process, while on the other it involves contacting multiple DNS servers. The diagram below shows the necessary steps in this process and does not take into account the browser cache.
Note: Learn more about DNS by reading up on DNS record types.
Why is DNS Cached?
DNS caching or flushing is an effective way to reduce potential DNS queries towards DNS nameservers. This speeds up the domain name resolving procedure.
Caching happens at multiple locations. This includes your computer, sometimes routers, while all DNS servers have their own databases with cached information.
Step 1 – Send a Request to Resolve a Domain Name
When you type
www.phoenixnap.com into a browser, in order to load the webpage, your computer asks for the IP address. Computers do not know in advance where they can find the necessary information, so they try searching through the DNS cache and any available external source.
Step 2 – Search for an IP Locally
Before going externally, your computer loads the local DNS cache database to see if you already requested the IP for that domain name. Every computer has a temporary cache with the most recent DNS requests and attempts to connect to online sources.
When the DNS cache has the IP data for the website that you are trying to connect to, the page loads immediately. DNS cache expedites this lookup process since the computer contains the information it needs and does not have to forward the request to your ISP.
Step 3 – Contact ISP and its Recursive DNS Server to Resolve a Domain Name
A computer’s local DNS cache database does not always contain the necessary data to resolve a domain name. In that case, the request goes further to your Internet Service Provider (ISP) and its DNS server.
Once it gets a request, the resolver looks in its records to provide the correct IP address. When the necessary information is present in the ISP server’s cached records, the computer gets back the IP and connects to the website. If ISP’s recursive DNS server cannot resolve the domain name, it contacts other DNS servers to provide the information back to you. This is why we call them recursive servers. Every Internet Service Provider has at least a secondary DNS server setup to ensure maximum high availability of the service.
Step 4 – Ask Outside DNS Servers to Provide an IP Address
ISP DNS resolvers are configured to ask other DNS servers for correct IP address mapping until they can provide data back to the requester. These are iterative DNS queries.
When a DNS client sends such a request, the first responding server does not provide the needed IP address. Instead, it directs the request to another server that is lower in the DNS hierarchy, and that one to another until the IP address is fully resolved. There are a few stops in this process.
- Root domain nameservers. Root servers themselves do not map IP addresses to domain names. Instead, they hold the information about all top-level domain (TLD) nameservers and point to their location. TLD is the rightmost section of a domain name, for example, .com in
phoenixnap.comor .org in
www.technology.org. Root servers are critical since they are the first stop for all DNS lookup requests.
- TLD nameservers. These servers contain the data for second-level domains, such as ‘phoenixnap’ in
phoenixnap.com. Previously, the root server pointed to the location of the TLD server. Then, the TLD server needs to direct the request toward the server that contains the necessary data for the website we are trying to reach.
- Authoritative nameserver. Authoritative servers are the final destination for DNS lookup requests. They provide the website’s IP address back to the recursive DNS servers. If the site has subdomains, the local DNS server will keep sending requests to the authoritative server until it finally resolves the IP address.
Step 5 – Receive the IP Address
Once the ISP’s recursive DNS server obtains the IP address by sending multiple iterative DNS queries, it finally returns it to your computer. The record for this request now stays cached on the hard drive. The browser can then fetch this IP from the cache and connect it to the website’s server.
When we break it down like this, the process of DNS lookup seems to take a long time to complete. In fact, it takes milliseconds, with maybe a few milliseconds more if the DNS record is not in the local cache. In both cases, users cannot tell the difference. This is a basic description of how DNS works, and it should give you an idea what goes on under the hood when you browse or send an email.
This article has explained what a Domain Name System is and how it works. It covered the essential DNS functions and what needs to happen before you can connect to an online server using its domain name.