The Domain Name System (or DNS) converts human-readable domain names (www.google.com) into Internet Protocol (IP) addresses (188.8.131.52).
Computers can only communicate using a series of numbers, so DNS was developed as a sort of “phone book” that translates the domain you enter in your browser into a computer readable IP.
A Brief History of the DNS:
Several years ago, when someone has to visit the website, he had to know the “IP address” i.e., 127.34.55.66 of that website as computers are and were only able to communicate using numbers. It was long, hard to remember, and human beings in general, would rather work with names that are easy to remember rather than numbers, but computers would rather work with numbers.
Human Beings don’t want to memorize the IP address of every website they visit, they would rather like to memorize things like Google.com, Paytm.com, Microsoft.com, etc. So something was needed to translate from those words into IP addresses.
As we all know Necessity is the mother of invention, hence DNS was born. Domain name system, DNS accomplishes exactly what was required. Now if a DNS server is queried to get an IP address of any domain, e.g., “abc.com”? It started responding with 127.34.55.66. The biggest problem of not to remember Ip Addresses was resolved.
How DNS was born?
In the early 1980’s, Paul Mockapetris came up with a system that automatically mapped IP addresses to domain names and DNS came into existence. This same system still serves as the backbone of today’s modern Internet.
The DNS is maintained by several organizations, including IANA (Internet Assigned Numbers Authority) and ICANN (Internet Corporation for Assigned Names and Numbers).
What DNS Servers hold?
DNS servers can hold many individual records. An individual record contains information about one Ip address. e.g., one name associated with one Ip address. Records come in different types, which have different purposes, and may contain slightly different information. There’s always a name and an IP address.
The most commonly DNS Records are mentioned below:
a) A record – An A/Address record/host record links a domain to the physical IP address of the server hosting the services.
b) AAAA record – which will give you an IPv6 version address.
c) MX Record – specifies a mail server responsible for accepting email messages on behalf of a recipient’s domain mail servers. Lower the Number, higher becomes the priority.
d) CNAME Records – CNAME stands for Canonical Name. It can be used to provide an alternate name to a primary domain.
e) SRV Records – SRV records are often used to help with service discovery. For example, SRV records are used in Internet Telephony for defining where a SIP service may be found. It defines a symbolic name and the transport protocol used as part of the domain name and defines the priority, weight, port, and target for the service in the record content.
Till now we have understood that in DNS IP address (number) is mapped to the domain name (which humans can understand), but where is this information stored? Is it on Name servers?
Name server (NS Record) records to determine which servers will communicate DNS information for a domain. Most name servers provided by hosts look something like ns1.yourhostdomain.com.
The Authoritative nameserver is the DNS Service Provider which can also be a DNS Registrar (like GoDaddy that offers both Domain Registration & DNS Service for that domain).
Practical Working of DNS:
When someone tries to open www.google.com, the browser will ask your local ISP’s DNS Server (which stores cache) if they have the DNS records for that domain cached.
As it’s a popular website like google.com its likely to have the record (Ip Address of Google.com) in ISP’s cache. In this case, you would skip the rest of the DNS lookup process as browser got the Ip Address to open the website. These records remain for a certain period of time in the cache defined in the TTL (Time to Live) & can be anywhere between 30 seconds to a week duration.
What if the record we are looking for isn’t cached? Then the ISP’s DNS Server will send the request further to the Root Hint servers to look for Top Level Domain (.com, .org etc.) which will point to the Authoritative DNS Server (cloud DNS) where all records for that domain would be hosted.
Let’s simplify it by a real-world example – Suppose we registered a domain abc.com with GoDaddy (we will also be taking DNS Services from it). So when a user being in any part of the world opens abc.com in the browser, it would try to reach abc.com web server using its stored Ip Address from its connected ISP’s DNS Server cache. In case if Ip address is not present in cache, then the request will be forwarded to Root Hint Servers which has information of all Top Level Domains (all .com domains) that this domain is registered with GoDaddy and the request will come to abc.com domain Registrar GoDaddy where Name Server would be having all other records hosted for domain “abc.com”. Hence, “A” record having the IP Address 127.34.55.66 of domain abc.com will be provided to the browser & website will open.
Note: There are 13 root hint servers in the world which keeps information of all Top Level Domains (.com, .org, .net etc) and would redirect to the Domain Registrar. From there it will look Name Server Records and will reach to the server where all DNS Records will be placed and from there, A record will be fetched and sent to the user looking for it.
When a user opens Google.com, how it reaches Google Server?
a) User types “www.google.com” into your browser.
b) The browser uses DNS to look up the nameservers for www.google.com in ISP’s DNS cache.
c) The nameservers ns1.google.com and ns2.google.com are retrieved from domain registrar of Google.
d) The browser uses the nameservers to look up the IP address for www.google.com.
e) The browser gets the response: “184.108.40.206”
f) The browser sends a request to 220.127.116.11, including the specific page you’re trying to reach.
g) The web server hosting your website sends the requested page to your browser.
I know trying to understand DNS for the first time is a little tricky & complicated. However, it could not be more simple than this. As from my personal experience, it takes around several months for a technical mind to understand the working of a DNS. I tried my level best to keep the explanation simple. I highly recommend you to read twice, thrice or as many times till you understand the working logic behind it.
Thanks a ton for reading my above blog. If you got to know something new & enjoyed my post, kindly post it in the comment section below.