# DNS and Domain Names

> Learn how names resolve to addresses, the common record types and how TTLs affect deployments. Free notes, key concepts, resources and a mini project.

Canonical: https://www.internhack.in/roadmaps/tracks/backend/dns
Last updated: 2026-11-28

Learn how names resolve to addresses, the common record types and how TTLs affect deployments.

Beginner · about 3 hours · difficulty 2/5

Learn first: [How the Internet Moves Data](https://www.internhack.in/roadmaps/tracks/backend/internet-basics)

The **Domain Name System** turns human names like `api.example.com` into IP addresses. When a client needs an address it asks a **recursive resolver** (from the ISP or a public one like 1.1.1.1), which walks the hierarchy: root servers, then the `.com` TLD servers, then the **authoritative** name servers for `example.com`. Answers are cached along the way for as long as the record's **TTL** allows.

### Records a backend developer touches

- **A / AAAA**: name to IPv4 / IPv6 address.
- **CNAME**: alias one name to another (you cannot put a CNAME at the zone apex on most providers).
- **MX**: mail servers for the domain.
- **TXT**: free text, used for domain verification, SPF and DKIM email authentication.
- **NS**: which servers are authoritative for the zone.

### Why it matters

DNS is part of every deployment. Pointing a domain at a new load balancer, verifying a domain for an email provider or switching hosting all mean editing records. Because of caching, a change is not instant: if the old record had a TTL of one day, some clients may keep the old address for a day. A common practice is to lower the TTL well before a planned migration.

### Pitfalls

- Forgetting that failures can be cached too (negative caching).
- Debugging "the site is down" without checking whether the name resolves. Use `dig` or `nslookup` first.

You are ready to move on when you can register a domain (or use a free subdomain), point it at a server and explain what `dig` shows you.

## Key concepts

- **Resolvers and authoritative servers**
- **A, AAAA and CNAME records**
- **MX and TXT records**
- **TTL and caching**
- **dig and nslookup**
- **DNSSEC**

## Mini project

Point a domain or free subdomain at a small server, then use dig to trace the lookup from the root servers down with dig +trace.

## Check yourself

You changed an A record 10 minutes ago but some users still hit the old server. Why, and how could you have prevented it?

## Free resources

- [What is DNS?](https://www.cloudflare.com/learning/dns/what-is-dns/) (Cloudflare)
- [MDN glossary: DNS](https://developer.mozilla.org/en-US/docs/Glossary/DNS) (MDN)

Previous: [HTTP in Depth](https://www.internhack.in/roadmaps/tracks/backend/http-protocol) · Next: [Where Backends Run: Hosting Options](https://www.internhack.in/roadmaps/tracks/backend/hosting-basics)

## More in How Requests Reach Your Server

- [How the Internet Moves Data](https://www.internhack.in/roadmaps/tracks/backend/internet-basics)
- [HTTP in Depth](https://www.internhack.in/roadmaps/tracks/backend/http-protocol)
- [DNS and Domain Names](https://www.internhack.in/roadmaps/tracks/backend/dns)
- [Where Backends Run: Hosting Options](https://www.internhack.in/roadmaps/tracks/backend/hosting-basics)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Backend Developer Roadmap](https://www.internhack.in/roadmaps/tracks/backend)
