Overview
Curated: · Written: · Reviewed:
DNS & DHCP
In one line
DNS maps names to typed records through a delegated hierarchy, and DHCP leases host configuration for a bounded time. Both publish state that clients and caches keep after the server changes, so a server edit is not what users see until they converge. Reach for this model whenever a question asks how a name becomes an address or how a device gets one.
Key definitions
- Recursive resolver: walks root, TLD and authoritative servers for the client, then caches each answer for its TTL.
- Authoritative server: answers with the
aaflag for a zone it holds. A referral (no answer, NS records in AUTHORITY) is not authority. - Delegation and glue: NS records at the parent cut; glue A/AAAA is required when the nameserver name sits under the zone it serves.
- Negative caching: NXDOMAIN and no-data answers are cached for the lesser of the SOA TTL and the SOA MINIMUM field (RFC 2308).
- T1 and T2: renewal and rebinding points inside a DHCP lease.
- giaddr: the relay's address, which tells the server which scope to use and where to send the OFFER.
Formulas and complexity
Quote the 1232-byte UDP payload size as the recommended ceiling. Responses above it fall back to TCP, so a blocked TCP/53 breaks large answers and DNSSEC.
How it works
- The stub sends a recursive query to its resolver over UDP/53, retrying over TCP when a response arrives truncated.
- A live positive or negative cache entry ends the lookup, so most queries never reach the hierarchy.
- On a miss, the resolver follows referrals from root to TLD to authoritative server until it gets an answer with
aa. - Every layer caches for the remaining TTL, so stale answers persist up to the old TTL at each hop.
DHCPv4 runs DORA. The client renews unicast at T1, rebinds by broadcast at T2, and at expiry drops the address and restarts from Discover.
When to use and when not to
| Decision | Use when | Avoid when |
|---|---|---|
| Recursion at each edge site | Local cache hits and survival through WAN loss matter | You cannot run, secure and monitor many resolvers |
| Central recursion with forwarders | Governance and monitoring matter most | The central resolver becomes a single point of failure |
| Conditional forwarding | Internal names must stay off public resolvers | The name must resolve publicly |
| Split-horizon views | Private endpoints need different answers | Internal data would be copied to public servers |
| DHCP reservation | Infrastructure devices need a stable address | You need authentication, since MAC is spoofable |
| DoT or DoH | Managed clients should use a governed resolver | You expect the answer itself to be authentic |
| DNSSEC | Answers need origin authentication | No key rollover plan exists |
Traps interviewers probe
- Expecting a change to take effect at once. Caches hold the old record until its TTL expires. Lower the TTL one old-TTL ahead of the cut, then check from several resolvers.
- Creating a name after a recent NXDOMAIN. The negative entry lasts min(SOA TTL, MINIMUM). Wait it out or lower the SOA MINIMUM ahead of time.
- Putting a CNAME beside other data, or at the apex. The owner name may hold nothing else, and the apex must hold SOA and NS. Use A/AAAA, or a provider ALIAS/ANAME that is not a standard record.
- Assuming delegation is healthy because one resolver works. Check each NS with
dig +norecurse, look foraaover UDP and TCP, and test from more than one network, since cached glue hides lame servers. - Treating encryption or a resolved IP as trust. DoT and DoH protect the hop, DNSSEC authenticates data, and a valid address proves nothing about reachability or authorization.
Interview tips
Open with the core idea: the server change is instant, and the world converges on TTL or lease time. Then name the cache that holds the stale data.
Expect these follow-ups:
- A record changed an hour ago and some clients still hit the old address. Which caches hold it, what TTL applied, and whether a negative entry predates the record.
- A host shows 169.254 addresses. Check the relay path, scope availability, and rogue or missing servers.
- DNSSEC key rollover. Explain the pre-publish or double-sign window and test with a validating resolver first.
- Where recursion lives. Compare edge and central placement and explain why open recursion is unacceptable.
- Lease database loss. Explain why re-offering from an empty database creates duplicate addresses, and why allocation should wait or run conflict checks first.
30-second outline: (1) A stub asks a recursive resolver, which walks root, TLD and authoritative servers and caches each answer for its TTL. (2) So changes converge over TTL, and negative answers are cached too. (3) To diagnose, I compare answers from the authoritative server and a recursive resolver, and check which cache holds the stale data. (4) For a migration I lower the TTL ahead of time, cut over, watch old traffic drain, then restore the TTL.
Feedback on this overview
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.