The Domain Name System is an essential component of the Internet’s functionality and usability. The DNS is like a phonebook for the internet. Let’s say we know a person’s name but we do not know their phone number; We can however find it in the phonebook. A DNS provides the same service on the Internet.
When we visit https://www.eltoma-it.com, our computer uses a DNS to retrieve the website’s IP address. Without a DNS we would only be able to visit our website via an IP address.
How Does The DNS Work?
Here is a sequence of the process, which takes only milliseconds to complete:
Information is requested > Recursive DNS servers asked > Root name servers asked > TLD asked > the authoritative DNS servers are also asked > Relevant records retrieved > Answer is then received.
A request starts from the moment we ask our computer to resolve a hostname by visiting https://www.eltoma-it.com. Firstly our PC looks for a local DNS cache, which stores all information our computer has recently received. If our computer can’t find the answer from the local cache, it will then need to perform a DNS query.
Ask Recursive DNS Servers
If our computer does not have the requested information, it asks the ISP’s (Internet Service Provider’s) recursive DNS to perform the work to answer the DNS query on our behalf. The ISP’s server normally has its own extensive cache, so the processes usually finish here and the necessary information returned to the user.
Ask Root Nameservers
If recursive servers do not have an answer, they ask root name servers. A nameserver is a server which answers question about domain names & IP addresses. Root name servers act as a telephone switchboard for the DNS. They do not know themselves, but can redirect the query to someone who knows where to find the answer.
Ask TLD (Top Level Domain) Nameservers
Root name servers will check the first part of our request, reading from right to left and then direct our query to the TLD. .com, .org, .us all have their own nameservers, which work like a receptionist for each TLD. Again if these servers do not have the required information, they can redirect us to the servers which have what we are looking for.
Ask the Authoritative DNS Servers
Authoritative nameservers are servers that give answers in response to questions asked about names in a specific zone. TLD nameservers check the next part of our request [www.eltoma-it .com] and direct our query to nameservers which are responsible for this particular domain. Authoritative nameservers know all information about any domains, which are in turn stored in DNS records. There are many types of records, and each record holds different information.
If we need to know the IP address of www.eltoma-it.com, we can ask authoritative nameserver for an Address RECORD (A) for example.
Retrieve the Records
In our continuing example a recursive server retrieves an Address Record (A) for eltoma-it.com from authoritative nameservers and stores that record in local cache. If someone else requests the host record for eltoma-it.com, the recursive server will already have the answer and will not need to go through the lookup process again. All these records have a time-to-live value. Recursive servers will need to ask for a new copy of records again, in order to make sure information does not become out of date.
Receive the Answer
When the recursive server has an answer, it returns the Record (A) back to your computer. Your computer then stores this record in a cache, and retrieves the IP address from the records, passing all information to the browser which in turn opens a connection to the web server and retrieves the website’s data.