The world wide web (WWW) is working with IP addresses and DNS entries. The Domain Name System (DNS) translates domain names into IP addresses. But how does it do that? And, perhaps even more importantly, why?
Why Do We Need Domain Name System?
When you search for a web address online, your web browser has to find the correct IP address for that particular page. Domain Name System’s (DNS) main job is to translate your domain name into an IP address that the browser can use to load the correct webpage.
DNS is necessary because humans navigate the web using domain names, whereas computers rely on IP addresses. Without the Domain Name System, we would all have to remember individual strings of numbers to visit our favorite websites.
How Does DNS Work?
When you search for a webpage, you kickstart a DNS query. Your browser doesn’t know the correct IP address, and so it sends out a lookup request for DNS to carry out. This process relies on four DNS servers working together to return the correct IP address to the web browser.
As we run through each server’s role, and each stage of the DNS query, remember that the whole DNS lookup process happens faster than the blink of an eye!
Four DNS Servers
The four DNS servers each have their own role within the DNS process – you can think of them like team members working in a library.
Here’s a quick introduction to each server and their individual roles:
- Resolving name server – front desk: this is the first server in the process. It receives the initial request and visits each of the other servers in turn until it can deliver an IP address back to the web browser.
- Root name server – librarian: this is the first server the resolving name server visits. Its main role is to show the resolving name server where to find the correct TLD name server!
- TLD (Top Level Domain) name server – archive keeper: if the web address ends in .com, then the resolving name server needs to visit a .com TLD name server. This can narrow down the search, identifying the correct authoritative name server.
- Authoritative name server – translator: the last server in the lookup process, this server can provide the correct IP address for the original query.
The Domain Name System Process: Start to Finish
- Someone searches for a web address – www.skillzme.com, for example.
- The web browser checks its cache (memory) to see if it already has the correct IP address. In this example, it doesn’t, so it sends a query to the computer’s operating system, in case the IP address is stored there.
- The operating system doesn’t know the IP address either, so it launches a DNS query – it asks the resolving name server for the IP address for www.skillzme.com.
- The resolving name server doesn’t have the correct IP address stored in its cache, so it asks a root name server.
- The root name server sends the resolving name server to the right .com TLD name server.
- The resolving name server queries the .com TLD name server.
- The TLD name server doesn’t have the IP address, but it does know which authoritative name server will have answers. It shows the resolving name server where the skillzme.com name server is.
- The resolving name server now queries the authoritative techspace.com name server. This time, it gets an answer! The authoritative name server responds with the correct IP address for www.skillzme.com.
- The resolving name server puts the IP address in its cache and returns to the computer’s operating system, which passes the IP address to the web browser.
- The web browser connects to the IP address and uses it to load the correct webpage for www.skillzme.com!
How Domain Name System Happens So Fast
Looking at the steps of the DNS query, it’s hard to believe that the IP address is requested, found, and returned faster than the blink of an eye. Luckily, DNS is a supremely efficient process that has its own tricks for keeping things speedy.
Different Types of Domain Name System Query
To avoid the servers becoming overwhelmed and bogged down with requests, there are different types of queries. This distributes the pressure on the servers by changing up the journey rather than going through every step, every time:
- Recursive query: in this query, the DNS must deliver an answer, whether that’s the IP address or an error message. Here, the resolving name server goes through the full lookup process listed above until it finds an answer.
- Iterative query: this is where the DNS provides the best answer it can to the user. So if the IP address is stored in the resolving name server’s cache, for example, there’s no need to carry out the whole DNS lookup process. Alternatively, the DNS lookup will go through each stage of the process until the user either receives the correct IP address or an error message.
- Non-recursive query: in this type of query, the DNS already knows the answer! For example, it already has the correct information stored in its cache, and can provide an immediate response.
Caching is the perfect tool for speeding up DNS queries because it stores data in a variety of locations. This means the request can be fulfilled as soon as possible and often remove the need for every step of the DNS lookup process.
Usually, it’s best for data to be stored as close to the user as possible, to deliver the fastest results:
- Browser caching. By saving DNS records, web browsers can immediately deliver the correct IP address without needing to outsource to the DNS. Checking the web browser’s cache is always the first step before launching a DNS query.
- Operating system-level caching. If a web browser doesn’t have an IP address, it sends a request internally to the computer’s operating system. If the operating system doesn’t have the data stored in its cache, that’s when the request gets launched externally to the DNS.
The Domain Name System has many moving parts, which can make it a daunting process to get to grips with at first glance. However, when you look closer it’s an extremely efficient and speedy system, designed to deliver results as fast as possible. Without DNS, the way we navigate the web would look very different indeed!