Ravindra BagaleCourses & study guides

Chapter 9: Domain Names, DNS and Subdomains

Interview Questions

Q1. Explain how DNS resolution works when you type a URL.
Browser/OS cache and hosts file → recursive resolver → root server → TLD server (returns NS of the domain) → authoritative name server (returns the record) → resolver caches it for the TTL and returns the IP → browser connects.
Q2. What is the difference between an A record and a CNAME?
An A record maps a name to an IPv4 address. A CNAME maps a name to another name, which is then resolved. A CNAME can't be used at the zone apex or alongside other records for the same name.
Q3. What is TTL? How would you plan a server migration with minimum DNS delay?
Time To Live, the number of seconds a resolver may cache a record. Lower the TTL (e.g. 300) well before the change, switch the record (or better, move the Elastic IP), verify, then raise the TTL again.
Q4. What is the difference between a registrar and a DNS hosting provider?
The registrar registers and renews the domain and stores which name servers are authoritative. The DNS host runs those name servers and answers queries with your records. They can be the same company or different ones (GoDaddy registrar + Route 53 DNS).
Q5. How do you host blog.example.com on the same EC2 instance as example.com?
Add a DNS record blog (A to the same Elastic IP), create /var/www/blog, add a server block/virtual host with server_name blog.example.com, test, reload and optionally extend the certificate with certbot.
Q6. Why use an Elastic IP or load balancer for DNS records?
The auto-assigned public IP changes on stop/start. A DNS record pointing to it would break, or point to someone else's instance.
Q7. What is a Route 53 Alias record?
A Route 53 extension that maps a name, including the zone apex, to AWS resources like load balancers, CloudFront or S3 websites. It follows their IP changes automatically, and alias queries to AWS resources are not charged.
Q8. Which commands do you use to check DNS?
dig name +short, dig @8.8.8.8 name, dig NS domain, dig +trace name, nslookup name, host name.