There are many servers all over the world. Every server has a unique IP Address and is identified by that IP Address. That brings us to the bulk of the IP address. And you the pproblem with numbers they hard to remember due to their intangibility, the human has always struggled to come with the ways of avoiding the problem of remembering them. Long story short, remembering www.google.com is far easier than remembering 220.127.116.11 unless you are suffering from Hyperthymesia.
When you visit https://google.com in a browser, your computer uses DNS to retrieve the website’s IP address of 18.104.22.168, in just a split of a second. Without DNS, you would only be able to visit Google’s website (or any website) by visiting its IP address directly, such as http://22.214.171.124. Hence, DNS is fundamentally the backbone bone of the internet.
So, what eactly is DNS?
Remember how you used to have those phonebook diaries where you put the name and phone number corresponding to them. This diary acts like a map for the name to corresponding phones. DNS is like a phone book for the internet. If you know a person’s name but don’t know their telephone number, you can simply look it up in a phone book. DNS provides this same service to the internet, of course, they are much more complex then phonebook but at a basic level, they have the same function.
When you visit https://google.com in a browser, your computer uses DNS to retrieve the website’s IP address of 126.96.36.199, in just a split of second. Without DNS, you would only be able to visit google’s website (or any website) by visiting its IP address directly, such as http://188.8.131.52.
Hence, DNS is fundamentally the backbone bone of the internet.
Why DNS Is Important?
- Web browsers interact through Internet Protocol (IP) addresses.
- Elimination of the need for humans to memorize complex IP addresses.
- For many reasons, server’s ip needs to be changed, so DNS helps in eliminating those problem of working about any changes in underlying system.
## DNS hierachy
1. Root Level / zone servers
It is the highest level in DNS hierarchy. The first step in resolving the domain name is root servers. It provides a list of authoritative name servers for top level domain (TLD). These servers have the list of all top level domains (TLDs). There are 13 root DNS servers all over the world. These root servers are named as A-root server, B-root server and so on upto K-root server. Root servers hold the information of each TLD that where is it located and what is its IP Address.
If you want more information about root servers that where are they located and who owns them or any other info, then you need to go http://www.root-servers.org.
2. Top Level Domains (TLD)
TLD is at the 2nd highest level domains in the hierarchical Domain Name System of the Internet. Top level domains are .com, .org, .edu etc. It will make more sense, if you take a look at DNS hierarchy diagram.
3. Second Level domains
It is 3rd level in the hierarchical Domain Name System of the internet. It is directly below the TLD. dailywebsolutions.com is an example of second level domains because it is directly below .com TLD.
Sub domain is considered as the part of the second level domains. Let’s consider mail.dailywebsolutions.com, here mail is the sub domain of a 2nd level domain dailywebsolutions and .com is the TLD.
How DNS works?
Step 1: Request information
The process begins when you ask your computer to resolve a hostname, such as visiting https://dyn.com. The first place your computer looks for the corresponding IP address is its local DNS cache, which stores information that your computer has recently retrieved.
If your computer doesn’t already know the answer, it needs to perform a DNS query to find out.
Step 2: Ask the recursive DNS servers
If the information is not stored locally, your computer queries (contacts) the recursive DNS servers (resolvers) from your internet service provider (ISP). These specialized computers perform the legwork of a DNS query on your behalf. Resolvers have their own caches, and given that many of the ISP’s customers are using the same resolvers, there is a reasonable chance that popular domains will already be cached. If this is the case for our example, dyn.com, the process usually ends here and the information is returned to the user.
Just about every ISP runs their own resolvers, yet those aren’t necessarily what you could be using. Some companies and perhaps even technically sophisticated home users could run their own resolvers on site. Additionally, there are several very popular open resolvers available, including Google Public DNS, OpenDNS, Dyn Recursive DNS, and Quad9.
Step 3: Ask the root name servers
If the recursive servers don’t have the answer, they query the root name servers. A name server is a computer that answers questions about domain names, such as IP addresses. These 13 servers act as a kind of telephone switchboard for DNS. They don’t know the answer, but they can direct DNS queries to someone that knows where to find it.
Step 4: Ask the TLD name servers
The root name servers will look at the first part of our request, reading from right to left — www.dyn.com — and in our case, direct our query to the top-level domain (TLD) name servers for .com. Each TLD, such as those for .com, .org, and .us, has its own set of name servers, which act like a receptionist for each TLD. These servers don’t have the information we need, but they can refer us directly to the servers that do have the information.
Step 5: Ask the authoritative DNS servers
The TLD name servers review the next part of our request — www.dyn.com — and direct our query to the name servers responsible for this specific domain. These authoritative name servers are responsible for knowing all the information about a specific domain, which is stored in DNS records. There are many types of records, which each contain a different kind of information.
In this example, we want to know the IP address for www.dyn.com, so we ask the authoritative name server for the address record (A record). Some authoritative name servers have intelligence that can analyze an incoming DNS query and return a response that is more performant for the user that originated the query.
Step 6: Retrieve the record
The recursive server retrieves the A record for dyn.com from the authoritative name servers and stores the record in its local cache. If anyone else requests the host record for dyn.com, the recursive server will already have the answer and will not need to go through the lookup process again. All records have a time-to-live value, which is like an expiration date. After a while, the recursive server will need to ask for a new copy of the record to make sure the information doesn’t become out-of-date.
Step 7: Receive the answer
Armed with the answer, recursive server returns the A record back to your computer. Your computer stores the record in its cache, reads the IP address from the record, then passes this information to your browser. The browser then opens a connection to the webserver and receives the website.
This entire process, from start to finish, takes only milliseconds to complete.
More: https://www.verisign.com/en_US/website-presence/online/how-dns-works/index.xhtml gives more interactive way to understand DNS