Shorts: DNS — Why and how

Aditya Agrawal
2 min readAug 27, 2021

This is a short article explaining the need and working of DNS. This is not a detailed article, just an intro 😉.

The Need

Information on the internet is shared using requests from one place to another. But to reach some destination one should know where to go first (how to go is a different story but obviously is needed).

In beginning, as computers talks in numbers, people used to remember IPs (4-part numbers, 133.94.83.4) for each server. As there were quantitatively low users of the internet, an IP is assigned to each user which stays with them for a long time but as the userbase increased it challenged the human memory (remembering stuff, eh 🙄) to remembers weird numbers (more eh 🙄🙄).

To overcome this and considering the fact that one would remember his favorite bakery’s web address by its name — mybakery.com, instead of some weird numbers — 92.133.64.9, the Domain Name System (DNS) was planted.

What is DNS

The idea was simple, hide the addresses (IPs) behind lovely names which we can remember. The job of remembering this will be given to a separate machine, a.k.a., a DNS server. A DNS server provides a functionality of a fictional button (can be implemented though, just saying). Click it and an address will pop up at your service (again reaching there is a different story). Now you can use this address to communicate with your favorite service.

How it works

A DNS server has records which corresponds to IP addresses, set by the domain owner. These can also be separated according to the service needed (Mail (MX), Aliasing (CNAME), Point to IPv4(AA)/IPv6(AAAA), some text for verification purposes (TXT)).

As these records are highly demanded, these are cached at several levels. This causes delay when you do some changes (changes >>> addition).

So, when you enter medium.com in your browser’s address bar a request is sent to the set DNS server (by ISP or you (why you here then)). It returns an IP which you can use to request your service. P.S: This happens in a question answer format.

Additional Benefits

  • Same IP multiple domains — Reverse proxy: Two domains can point to same IPs but different content is served based on the domain (See Implementation at GitHub Pages)
  • Same name changing IP: You can change the IP for your domain anytime you want. This is especially useful during downtime, switching machines, upgrades and other reasons which may cause change in the address.
  • Load Balancing: Who said you’re limited to provide only one address for your home, you might own multiple houses right. You can distribute the work this way if you have tremendous number of users.

Interesting Reads

DigitalOcean Referral

--

--

Aditya Agrawal

It’s about finding the needed thing at the perfect time.