DNS and How Domains Reach Your Servers

Understand how DNS resolution works, the record types you will configure, and how TTLs affect migrations and failovers.

Beginner · about 4 hours · difficulty 2/5

Learn first: Networking Fundamentals: IP, CIDR, TCP and Ports

Every time a user opens your app, DNS translates a name like app.example.in into an IP address. Misconfigured DNS is one of the most common causes of "the site is down".

How resolution works

  1. The browser asks a recursive resolver (your ISP, 8.8.8.8 or 1.1.1.1).
  2. The resolver asks a root server, then the TLD server (.com, .in), then the domain's authoritative name server.
  3. The answer is cached for the record's TTL (time to live).

Record types you will use

  • A (IPv4) and AAAA (IPv6): name to address.
  • CNAME: name to another name. Cannot be used at the zone apex (example.com).
  • Alias (Route 53 specific): like a CNAME but allowed at the apex and free for AWS targets such as an ALB or CloudFront.
  • MX: mail servers. TXT: verification and email security (SPF, DKIM, DMARC). NS and SOA: who is authoritative.

DNS on AWS

Amazon Route 53 hosts public and private zones, supports routing policies (simple, weighted, latency, failover, geolocation) and health checks. Azure DNS and Google Cloud DNS provide the same features.

Pitfalls

  • Changing a record with a 24 hour TTL right before a migration. Lower the TTL a day in advance.
  • Pointing a CNAME at the apex, which DNS does not allow.
  • Forgetting that registrar (where you bought the domain) and DNS host can be different.

You are ready to move on when you can use dig to trace a domain from the root down and explain every record you see.

Key concepts

  • Recursive vs authoritative resolvers
  • A, AAAA, CNAME, MX, TXT, NS records
  • TTL and caching
  • Route 53 alias records
  • Routing policies: Weighted, latency, failover
  • dig and nslookup
  • Private hosted zones

Mini project

Run dig +trace on three domains (an Indian bank, your college site and a startup) and write down the name servers, record types and TTLs you find. Note which ones use Route 53 or Cloudflare. Purely local, no cost.

Check yourself

Why can you not create a CNAME for example.com itself, and what does Route 53 offer instead?

Free resources