Domain Name System (DNS) is a decentralised naming system that turns domain names into IP addresses. It has often been compared to the internet’s phonebook. However, instead of a phone number assigned to a person, DNS assigns a unique IP address to every device that connects to the internet. And just as each of these internet-enabled devices has its own unique identifier, so too does each website in the form of its domain name.
DNS is needed because web servers cannot read URLs (e.g. www.example.com) that a user types in. The DNS translates these domains into machine-readable IP addresses (e.g. 192.168.1.1). DNS also helps correctly identify the location of the website’s files according to their IP address, allowing a user to get the right information when they visit a page.
How DNS Works
When a user types in a URL, it goes through four DNS servers before the IP address is created and the webpage is loaded:
1. DNS recursor — Also called DNS resolver, this receives the query then communicates it with other DNS servers. It also makes additional requests depending on the client’s DNS query. This is the middleman between a user and the authoritative nameserver (the last step of an IP address). Think of this as the librarian who receives book requests.
2. Root nameservers — Responds to the resolver by directing queries to the right top level domain (TLD) nameserver depending on the domain’s extension (e.g. .edu, .com, .uk, etc). In keeping with the library analogy, this is the library’s index which indicates where different books can be found.
3. TLD nameservers — The top level domain (TLD) server hosts a domain’s last portion (e.g. .edu, .com, .uk, etc). It maintains information for all domains that have the same extension, and points to the authoritative nameserver for that domain. TLDs can be compared to the specific shelf of books in a library.
4. Authoritative nameservers — This is the final step for a query. After accessing the right records, authoritative nameservers will send the IP address to the DNS recursor. The recursor sends the information back to the computer, the computer connects to the IP address, and the user gets to access the website.
All these steps happen on the backend of a website and only requires a user to type in the URL.