Published
Author
March 7th, 2023
Priyatham Vinnakota
Introduction
Why do we save contacts on our mobiles? Because we can't recall everyone's phone numbers. Similarly, each computer is uniquely identified by its IP address (like 142.250.196.174). So, if you want to access YouTube, you should use the IP address of the server (or computer) where YouTube is hosted, which is difficult for anyone to remember. Therefore, we need to give it a simple name like www.youtube.com and have that mapping configured somewhere. This mapping is setup using the Domain Name System (DNS).
Domain name system is a naming service that maps domain names to machine’s IP addresses.
DNS resolution process
- When you visit https://www.youtube.com on your browser, the browser asks your Internet Service Provider (ISP) for a list of YouTube’s IP addresses.
- The ISP then forwards the DNS query to the DNS infrastructure (more on DNS Infra below).
- DNS infrastructure resolves the DNS query and returns a list of IP addresses.
- ISP will return these IP address list to the browser.
- The browser then routes the HTTP request to the web server's IP address where the site is hosted.
- Web servers returns the HTTP Response, which we see as a website on our browser.
<aside>
📎 An Internet Service Provider is a company that provides internet access to customers. Some famous ISPs are Verizon, AT&T, Airtel, Hathway, and others.
</aside>
DNS Infrastructure
DNS is not a single server, it is a complete infrastructure with a lot of servers.
- The servers that respond to users queries are called Name Servers.
- Domain name to IP address mapping is stored in the form of Resource Records (RR). There are mainly 4 types of Resource Records:
- A record (Address record) - Provides the mapping between domain name to IP address.
- NS record (Name Server record) - Provides the mapping between domain name to its authoritative name servers.
- CNAME record (Canonical name record) - Provides the mapping between one domain name to another domain name. Mainly used to create an alias for a domain name.
- MX record (Mail exchanger record) - Provides mapping of mail server from alias to canonical hostname.