</>
ShikshaCSLearn. Code. Grow.
๐Ÿ”
โ˜• Support Us
ShikshaCSโ€บNotesโ€บComputer Networks
Computer Networks
๐Ÿ•’ 9 min read

DNS (Domain Name System)

The internet's phonebook โ€” turning easy-to-remember names into actual IP addresses.

Why DNS Exists

Computers communicate using IP addresses (like 142.250.190.78), but humans can't realistically remember thousands of numeric addresses for every website they visit. DNS solves this by letting you type a memorable name (like google.com) which gets automatically translated into the correct numeric IP address behind the scenes.

How a DNS Lookup Works, Step by Step

1) Your browser first checks its own cache โ€” has it looked this up recently? 2) If not, it asks a DNS Resolver (usually run by your ISP or a public service like Google's 8.8.8.8). 3) The resolver asks a Root DNS server, which points it toward the correct Top-Level Domain (TLD) server (like the one managing all '.com' domains). 4) The TLD server points to the Authoritative DNS server for that specific domain, which finally returns the actual IP address.

DNS Caching

To avoid repeating this multi-step lookup process for every single request, DNS results are cached at multiple levels โ€” your browser, your operating system, and your ISP's resolver all temporarily store recent lookups. Each DNS record has a TTL (Time To Live) value specifying how long it should be cached before being looked up fresh again.

Common DNS Record Types

A Record: maps a domain name directly to an IPv4 address. AAAA Record: maps a domain name to an IPv6 address. CNAME Record: creates an alias pointing one domain name to another domain name. MX Record: specifies which mail servers handle email for a domain. These records are what actually get stored and returned by authoritative DNS servers.

What Happens Without DNS

If DNS were to fail entirely, you'd need to manually type raw IP addresses to visit any website โ€” no memorable names at all. This is actually why sometimes you can access a website by typing its raw IP address directly even when DNS itself is having temporary issues, since the underlying network connection doesn't strictly require DNS, only convenience does.

๐ŸŒ Real-World Use

Every time you type a website name into your browser, dozens of these DNS lookup steps happen behind the scenes in usually under 100 milliseconds โ€” services like Google DNS (8.8.8.8) and Cloudflare DNS (1.1.1.1) exist specifically to provide fast, reliable public resolvers as an alternative to your ISP's own DNS servers.

๐Ÿ’ก Pro Tip

A frequently asked question: 'why is DNS caching important?' โ€” the honest answer is performance AND reduced load: without caching, EVERY single website visit would require the full multi-step lookup chain (root โ†’ TLD โ†’ authoritative), which would make browsing noticeably slower and put enormous strain on root/TLD servers globally.

๐Ÿงช Quick Self-Test

Check what you just learned โ€” no pressure, just practice.

1. What is the main purpose of DNS?

2. Which DNS record type maps a domain to an IPv4 address?

3. What does a DNS record's TTL value control?

โ† Back to all Notes