Copy of domain name system
What is DNS
Imagine if you had to remember the IP addresses of all the well-known websites that you visit frequently over the Internet. This means that you had to remember 104.18.3.119 to visit www.educative.io. Of course, this would not be possible/feasible because we often visit many websites in a day, and also IPs of websites can change over time.
The Domain Name System (DNS) solves this problem precisely. It is the Internet’s naming service that maps human-friendly names (like www.educative.io) to machine-readable names (like 104.18.3.119). DNS is implemented in the form of a distributed database for the following reasons:
- Avoid becoming a Single Point Of Failure (SPOF).
- Achieve low query latency so users can get responses from nearby servers.
- Get a higher degree of flexibility during maintenance and updates/upgrades (for example using a different DNS name server if one is down, or DNS replying IPs to a different machine).
The slides below show the high-level flow of getting an IP for a website using DNS.
How DNS works
The DNS is not a single server that accepts requests and responds to user queries. It is a complete infrastructure with
There are mainly four types of servers in the DNS hierarchy:
- DNS resolver: resolvers initiate the querying sequence and forwards request to the other DNS name servers. Typically, DNS resolvers lie within the premise of the user’s network. However, DNS resolvers can also cater to users’ DNS queries through caching techniques, as we will see shortly. These servers can also be called local/default servers.
- Root-level name servers: these servers receive requests from local servers. Root name servers maintain name servers based on top-level domain names such as
.com
,.edu
,.us
, etc. For instance, when a user requests the IP address of educative.io, root-level name servers will return a list of Top Level Domain (TLD) servers that hold the IP addresses of the.io
domain. - Top Level Domain (TLD) name servers: These servers hold the IP addresses of authoritative name servers. The querying party will get a list of IP addresses that belong to the authoritative servers of the organization.
- Authoritative name servers: these are the organization’s DNS name servers that provide the IP addresses of the application servers or load balancers put in front of the application/web servers.
Food for thought
How are DNS names processed? i.e., will educative.io be processed from left to right or right to left?
Iterative vs. recursive query
There are two ways to perform a DNS query:
- Iterative: the local server requests the Root, TLD, and the Authoritative servers for the IP address.
- Recursive: the end-user requests the local
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy