Chapter 9: Domain Names, DNS and Subdomains
Practice Questions and Lab Exercises
- Label each part of
api.shop.example.co.in.(subdomain, second-level, TLD, root). - Explain registrar, registry, name server and web host with one example each.
- List eight DNS record types and one use of each.
- What is DNS propagation really? How does TTL affect it?
- Why can't you use a CNAME at the apex? What do you use instead on Route 53?
- Lab: Attach an Elastic IP to your web server and map
example.comandwww.example.comusing GoDaddy DNS (or your registrar). Verify withdigandnslookup. - Lab: Create
blog.andapi.subdomains:blogas a static site on the same server,apias a reverse proxy to a Node app on port 3000. - Lab: Create a Route 53 public hosted zone, recreate your records, switch the GoDaddy name servers and confirm with
dig NS. (Delete the hosted zone afterwards if you don't need it.) - Lab: Secure all names with one certbot command and test renewal with
--dry-run.
Quick Revision
- Domain parts, right to left: root
.→ TLD → your domain → subdomains (free, unlimited). - Registrar (buy/renew) ≠ name servers (answer DNS) ≠ web host (EC2).
- Resolution: cache → resolver → root → TLD → authoritative → cached for TTL. "Propagation" = caches expiring.
- Records: A (IPv4), AAAA, CNAME (alias, not at apex), MX, TXT, NS, SOA, CAA, Route 53 Alias.
- Setup: website works → Elastic IP (details in 14.1) → GoDaddy DNS: A
@→ EIP, CNAMEwww→@, remove parked records →server_name/ServerName+ServerAlias→ reload →dig→ certbot. - Route 53 option: hosted zone → copy 4 NS → set custom name servers at GoDaddy → recreate MX/TXT first.
- Subdomain = DNS record + its own server block/vhost (or proxy to an app).
- Verify:
dig +short,dig @8.8.8.8,dig NS,dig +trace,nslookup; flush local cache if needed.