The time before the Domain Name System
A long, long time ago, there was no Internet! Can you believe it? Back then, there were just a few university computers and some military ones linked together through different networks. They were working together, but with a lot of connection problems. The number of the devices started to grow, so did the connection between them.
Back then, each of the computers needed to have a hosts.txt file on their memory, which was basically a table with hosts’ names and their IP addresses. Like a table of A records, but of all possible devices that are there.
Imagine having to administrate a massive excel table with all the sites that you want to visit and their addresses. A lot of work!
The hosts.txt was not a viable option, so there was a need for a better system for that new thing called the World Wide Web. This is where the Domain Name System came.
Domain Name System explained
The Domain Name System (DNS) was the solution to the ever-growing number of hosts and IP addresses inside the hosts.txt file. It is a decentralized model that stores the data about the hosts in nameservers that are spread around the world and has a tree-like hierarchical structure. Each level knows the answer for a part that it is responsible for. The Root (top) can answer for the lover TLD level, the TLD level for the domain level, and it, for its subdomains.
Now there was a scalable alternative that was capable of storing data about many hosts and their location.
The DNS not only stores the data about the domains (their address in A or AAAA DNS records, and all the rest DNS record types), but also is very fast in responding to queries about them, thanks to the UDP. The UDP is a fast way of sending data that does not need to establish a connection in order to send packets.
So, to make the Domain Name System easy!
So to make the Domain Name System extremely easy – it is the world’s phonebook for names (hosts who can be websites, applications, devices) and their location (The IP addresses that could be IPv4 or IPv6).
DNS query explained
It has a tree-like structure, so your question for a domain name will take a few steps.
When you “call” (make a DNS query) a particular domain name, let’s say bing.com, first who will respond to you is the highest on the top of the tree – the Root nameservers. They will see your question and answer for the only thing they know, the next level of the tree, the top-level domain level. Each level has a dedicated job to answer you for a part below until you get your answer.
The next level, the TLD name servers, which are the servers of the domain extensions like .com, .it, .co.uk, etc., will answer the next part.
In our case, it will be the .com nameserver/s, so they will know where Bing is and redirect you to the nameservers of it.
Finally, you will get a clear answer from Bing’s nameservers with an IP address (IPv4 or IPv6 or both), and you can access the site when you already know where it is.
For the next time, you are trying to visit the same site, if it is not after a lot of time, you will have these addresses in your DNS cache. This will help your browser skips the steps and go directly to the previously known site.
Conclusion
The DNS is the supporting network of nameservers that makes possible the use of the Internet in a fast and easy way. Although it is far from perfect, it the solution that we, the people, have decided to use. It is convenient, and there are a lot of upgrades that have come through the years, like encryption and safer communication.