Skip to content
Tech Interview Prep
Technical interview guide

DNS & DHCP

How devices get an IP address automatically, and how domain names get resolved into one.

Minutes to read
4
Practice MCQs
25
Interview Q&A
25
Edition
v5
Editorial status
Reviewed

Scope: Current IETF DNS, negative caching, DNSSEC, DNS over TCP/TLS/HTTPS, DHCPv4/options/relay, DHCPv6, SLAAC, and mDNS references reviewed 2026-09-04.

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 aa flag 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

T1=0.5×LT2=0.875×LT_1 = 0.5 \times L \qquad T_2 = 0.875 \times L negative TTL=min⁡(SOA TTL,SOA MINIMUM)\text{negative TTL} = \min(\text{SOA TTL}, \text{SOA MINIMUM})

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

  1. The stub sends a recursive query to its resolver over UDP/53, retrying over TCP when a response arrives truncated.
  2. A live positive or negative cache entry ends the lookup, so most queries never reach the hierarchy.
  3. On a miss, the resolver follows referrals from root to TLD to authoritative server until it gets an answer with aa.
  4. 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.

referral .com referral example.com A record, TTL 300 cached answer Stub resolver Recursive resolver Root TLD server Authoritative server

When to use and when not to

DecisionUse whenAvoid when
Recursion at each edge siteLocal cache hits and survival through WAN loss matterYou cannot run, secure and monitor many resolvers
Central recursion with forwardersGovernance and monitoring matter mostThe central resolver becomes a single point of failure
Conditional forwardingInternal names must stay off public resolversThe name must resolve publicly
Split-horizon viewsPrivate endpoints need different answersInternal data would be copied to public servers
DHCP reservationInfrastructure devices need a stable addressYou need authentication, since MAC is spoofable
DoT or DoHManaged clients should use a governed resolverYou expect the answer itself to be authentic
DNSSECAnswers need origin authenticationNo key rollover plan exists

Traps interviewers probe

  1. 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.
  2. 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.
  3. 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.
  4. Assuming delegation is healthy because one resolver works. Check each NS with dig +norecurse, look for aa over UDP and TCP, and test from more than one network, since cached glue hides lame servers.
  5. 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.