Web / Core DNS Concepts Interview questions
Last updated
Core DNS Concepts Interview Questions & Answers
Table of Contents
1. What is DNS?
DNS, or the Domain Name System, is the internet's naming layer that maps human-friendly domain names like example.com to the numeric IP addresses computers use to route traffic.
Without it, every request would need a raw IP address, which is hard to remember and prone to change as servers move or scale.
DNS works as a globally distributed, hierarchical database. No single server holds every record; instead, resolvers, root servers, TLD servers, and authoritative name servers cooperate to answer each lookup.
It's one of the oldest pieces of internet infrastructure still in daily use, and almost every network request - web, email, API calls - starts with a DNS lookup.
2. What is a domain name?
A domain name is the readable label typed into a browser or used in an email address, such as mail.example.com, that identifies a resource on the internet.
Domain names are structured hierarchically and read right to left in terms of authority: the rightmost label is the top-level domain (TLD) (like .com or .org), the next label is the second-level domain (like example), and anything further left is a subdomain (like mail).
Each label is separated by a dot, and each one is registered or managed at a different level of the DNS hierarchy - which is exactly what lets DNS delegate authority instead of relying on one central list.
3. What is a DNS resolver?
A DNS resolver is the component that takes a domain name from a client - a browser, an app, an operating system - and does the work of tracking down its IP address.
Most people interact with a recursive resolver, typically run by their ISP or a public service like Google Public DNS or Cloudflare's 1.1.1.1. The client sends one query and expects a final answer back.
Behind the scenes, the resolver may need to contact several other servers - root, TLD, and authoritative - to build that answer, but the client never has to talk to any of them directly.
Resolvers also cache answers locally for the record's TTL, which is why repeated lookups for the same name are usually much faster than the first one.
4. What is a DNS record?
A DNS record is a single entry in a zone file that maps a name to a specific piece of data - most often an IP address, but sometimes mail server info, text data, or a pointer to another name.
Every record has a common shape: a name, a type (such as A, CNAME, or MX), a TTL controlling how long it can be cached, and a value specific to that type.
A domain typically has many records of different types working together - for example, an A record for the website, an MX record for mail, and a TXT record for domain verification, all under the same zone.
5. What are the types of DNS records?
DNS supports many record types, each serving a distinct purpose within a zone. The most commonly used ones in day-to-day work are:
- A - maps a name to an IPv4 address
- AAAA - maps a name to an IPv6 address
- CNAME - aliases a name to another name
- MX - specifies mail servers for the domain
- TXT - holds arbitrary text, often for verification or policy (SPF, DKIM)
- NS - delegates a zone to specific name servers
- SOA - holds zone administration metadata
- PTR - maps an IP address back to a name (reverse DNS)
Most zones use only a handful of these at once, but knowing what each type is for is what lets you read a zone file at a glance.
6. What is an A record?
An A record ("address" record) maps a domain name directly to an IPv4 address, such as pointing example.com to 93.184.216.34.
It's the most fundamental record type in DNS - when a browser resolves a website, it's usually chasing down an A (or AAAA) record as the final step before it can open a connection.
A zone can have multiple A records for the same name, each pointing to a different server; resolvers will typically return all of them, and the client picks one, which is the basis of simple round-robin load distribution.
example.com. 300 IN A 93.184.216.34
7. What is an AAAA record?
An AAAA record ("quad-A") maps a domain name to an IPv6 address, the 128-bit successor to the 32-bit IPv4 addressing used by A records.
It exists as a separate type - not a variant of A - because IPv6 addresses are a different length and format, and many networks and clients still need to fall back to IPv4 if no AAAA record is present.
Dual-stack setups publish both an A and an AAAA record for the same name so that clients can connect over whichever protocol their network supports.
example.com. 300 IN AAAA 2606:2800:220:1:248:1893:25c8:1946
8. What is a CNAME record?
A CNAME (Canonical Name) record makes one domain name an alias for another, telling the resolver "look up this other name instead" rather than providing an IP directly.
It's commonly used to point a subdomain like www.example.com or blog.example.com at a third-party service (a CDN, a hosting platform) whose IP addresses can change without the domain owner needing to update anything.
A key rule: a name with a CNAME record cannot have any other record type at that same name, since the alias is meant to be resolved exclusively through the chain it points to.
blog.example.com. 300 IN CNAME hosting.provider.net.
9. What is an MX record?
An MX (Mail Exchange) record specifies which mail servers are responsible for accepting email on behalf of a domain, so a message sent to user@example.com knows where to go.
Each MX record includes a priority value (lower numbers are preferred), which lets a domain list a primary mail server plus one or more backups for redundancy.
Unlike a CNAME, an MX record's value must point to a hostname that itself resolves to an A or AAAA record - it can't point directly to an IP address.
example.com. 3600 IN MX 10 mail1.example.com. example.com. 3600 IN MX 20 mail2.example.com.
10. What is a TXT record?
A TXT record stores arbitrary text data attached to a domain name, giving domain owners a flexible place to publish machine-readable information that doesn't fit any other record type.
In practice, TXT records are used heavily for email authentication and domain verification: SPF (which mail servers may send for this domain), DKIM (a public key for verifying signed mail), and DMARC policy statements are all published as TXT records.
Third-party services (Google Workspace, hosting providers, CDNs) also commonly ask a domain owner to add a specific TXT record just to prove they control the domain.
example.com. 3600 IN TXT "v=spf1 include:_spf.example.com ~all"
11. What is a DNS zone?
A DNS zone is a distinct, administratively separate portion of the DNS namespace - essentially, the set of records that a particular authority is responsible for managing.
A zone often corresponds to one domain (example.com and everything under it), but a domain can also be split across multiple zones - for example, delegating eu.example.com to a different zone with its own name servers.
Each zone has exactly one SOA record describing its administrative details, and is served by one or more authoritative name servers that are the source of truth for that zone's records.
12. What is a zone file?
A zone file is the plain-text file format used to define all the records within a DNS zone - it's the literal data an authoritative name server loads and serves.
It starts with directives like $ORIGIN and $TTL, followed by an SOA record, then the rest of the records (NS, A, MX, TXT, and so on) for that zone.
Each line generally follows the pattern name TTL class type value, and trailing dots after a name indicate it's fully qualified rather than relative to $ORIGIN.
$ORIGIN example.com. $TTL 3600 @ IN SOA ns1.example.com. admin.example.com. (2026091901 3600 900 1209600 3600) @ IN NS ns1.example.com. @ IN A 93.184.216.34
13. What is a name server?
A name server is a server that stores and answers queries about DNS records for one or more zones - it's the actual machine (or service) that responds when a resolver asks "what's the A record for this name?"
Name servers come in different roles: authoritative name servers hold the actual records for a zone and give definitive answers, while recursive resolvers don't own any zone data themselves but query other name servers on a client's behalf.
A domain's registrar records point to that domain's authoritative name servers via NS records, which is what tells the rest of the internet where to go for definitive answers about that domain.
14. What is a root name server?
Root name servers sit at the very top of the DNS hierarchy. They don't know the IP address for any specific website, but they know which name servers are authoritative for each top-level domain, like .com or .org.
There are 13 logical root server addresses (lettered A through M), each operated by different organizations and heavily replicated worldwide using anycast, so a query in Tokyo and a query in New York can both reach a "nearby" root server instance.
A resolver only needs to consult a root server when it has nothing cached for a given TLD; in practice, this happens far less often than people expect, since TLD referrals are themselves cached.
15. What is an authoritative name server?
An authoritative name server is the definitive source for a zone's records - it holds the actual zone file (or database-backed equivalent) and answers with data it owns, not data it looked up elsewhere.
When a recursive resolver finally reaches the authoritative server for example.com, the answer it gets back is marked as authoritative, meaning there's no more delegation to follow.
Domains typically configure at least two authoritative name servers, often on different networks, so that a single outage doesn't take the whole domain offline.
16. What is TTL in DNS?
TTL, or Time To Live, is a value attached to every DNS record that tells resolvers how long, in seconds, they're allowed to cache that record before they must ask the authoritative server again.
A short TTL (say, 60 seconds) means changes propagate quickly but generates more query traffic to the authoritative server; a long TTL (say, 86400 seconds, or one day) reduces load and speeds up repeat lookups but means changes take longer to reach everyone.
Before planning a migration or an IP change, it's common practice to lower the TTL well in advance so the old, cached answer expires everywhere quickly once the real change happens.
17. What is DNS caching?
DNS caching is the practice of storing the answer to a DNS query temporarily - at the resolver, the operating system, or even the browser - so that repeated lookups for the same name don't need to travel all the way back to the authoritative server each time.
Each cached entry is kept only as long as its record's TTL allows, after which it's considered stale and must be re-fetched.
Caching happens at several layers simultaneously: the browser may cache a lookup for a few minutes, the OS resolver for longer, and the recursive resolver for the full TTL - which is why clearing "your" DNS cache doesn't always immediately reflect a change made upstream.
18. What is a fully qualified domain name (FQDN)?
A fully qualified domain name specifies a host's exact position in the DNS hierarchy, all the way up to the root, such as www.example.com. - note the trailing dot representing the (usually invisible) root zone.
Because an FQDN is unambiguous and self-contained, resolvers can look it up directly without needing to append a default search domain, unlike a relative or partial hostname such as just www.
In everyday use the trailing dot is often omitted since most software adds it implicitly, but in zone files and some CLI tools, forgetting it can change a name's meaning entirely.
19. What is a subdomain?
A subdomain is a domain that exists under a parent domain in the DNS hierarchy, created by adding a label to the left of the parent name - for example, api.example.com is a subdomain of example.com.
Subdomains are useful for organizing different services or environments under one parent domain, such as staging.example.com for a test environment or shop.example.com for an e-commerce section.
A subdomain can have its own complete set of records (A, MX, TXT, and so on) independent of the parent, or it can even be delegated to entirely different name servers if needed.
20. What is a PTR record?
A PTR (pointer) record does reverse DNS - it maps an IP address back to a hostname, the opposite direction of an A or AAAA record.
PTR records live in a special reverse zone (in-addr.arpa for IPv4, ip6.arpa for IPv6), and are looked up by reversing the octets of the IP address as part of the query name.
They're commonly checked by mail servers as part of spam filtering, since a mismatched or missing PTR record is a common signal of an untrustworthy sending server.
34.216.184.93.in-addr.arpa. 3600 IN PTR example.com.
21. What is the difference between a recursive resolver and an authoritative name server?
A recursive resolver and an authoritative name server play opposite roles in resolving a single query, even though both are technically "name servers".
A recursive resolver, usually run by an ISP or a public DNS provider, accepts a query from a client and does all the work of chasing down the answer - contacting root, TLD, and authoritative servers as needed - then returns one final result. It owns no zone data of its own; everything it returns is either fetched live or served from cache.
An authoritative name server, by contrast, holds the actual zone file for a specific domain and gives a definitive, non-cached answer for names within that zone. It never queries anyone else on the client's behalf.
| Aspect | Recursive resolver | Authoritative name server |
| Owns zone data? | No | Yes |
| Talks to other servers? | Yes, on the client's behalf | No, only answers directly |
| Answer type | Often cached | Always authoritative |
| Example | 8.8.8.8, 1.1.1.1 | ns1.example.com |
22. How does DNS resolution work?
DNS resolution is the step-by-step process of turning a domain name into an IP address, and it typically unfolds like this for a name the resolver hasn't cached:
- The client asks its configured recursive resolver for the A record of, say,
www.example.com. - The resolver checks its own cache first; if nothing is cached, it asks a root name server.
- The root server doesn't know the answer but refers the resolver to the
.comTLD name servers. - The resolver asks a
.comTLD server, which refers it further to the authoritative name servers forexample.com. - The resolver asks an authoritative server for
example.com, which returns the actual A record. - The resolver caches the answer for the record's TTL and returns it to the client.
Each of these steps is skipped whenever a relevant answer is already cached somewhere along the chain, which is why most everyday lookups are much faster than this full walk.
23. What is the difference between an A record and a CNAME record?
An A record and a CNAME record both help resolve a name, but they point to fundamentally different kinds of values.
An A record maps a name directly to an IPv4 address - it's a terminal answer; the resolver has what it needs immediately.
A CNAME record maps a name to another domain name, which then has to be resolved itself, possibly through another CNAME, until an A or AAAA record is eventually reached.
| Aspect | A record | CNAME record |
| Points to | An IPv4 address | Another domain name |
| Resolution | Terminal - no further lookup needed | Requires resolving the target name too |
| Coexistence rule | Can coexist with other record types | Cannot coexist with other records at that name |
| Typical use | Root domain, direct IP mapping | Subdomains pointing to third-party services |
24. Why should you avoid pointing a CNAME record at your zone apex?
The zone apex (also called the root or naked domain, like example.com with no subdomain) is where the required SOA and NS records for the zone must live.
Because a CNAME record cannot coexist with any other record type at the same name, putting a CNAME at the apex would technically conflict with those mandatory records - most authoritative DNS software rejects it outright, which is formalized in RFC 1034/1035.
In practice, this becomes a real problem when someone wants to point their apex domain at a service that only offers a CNAME target (common with CDNs and PaaS providers), since example.com itself can't take a CNAME the way www.example.com can.
The common workaround is a provider-specific "ALIAS" or "flattened CNAME" record, or a well-managed A record pointing at the provider's stable anycast IPs, both of which behave like a CNAME at the DNS-serving layer without violating the apex restriction.
25. How does DNS caching improve performance?
DNS caching improves performance by short-circuiting the multi-step resolution walk (root, TLD, authoritative) for names that have already been looked up recently.
Instead of that round trip happening on every single request, a cached answer can be returned from local memory in microseconds, which matters enormously since most pages load dozens of distinct hostnames (assets, ad networks, APIs, fonts).
Caching also happens in layers - browser, OS stub resolver, recursive resolver - so a popular domain like a major CDN endpoint might already be cached at the recursive resolver level even for a user who's never visited that specific site, because someone else on the same resolver looked it up recently.
The trade-off is staleness: a cached answer is only as fresh as its TTL allows, so caching trades a small window of potential inaccuracy for a large reduction in latency and load on authoritative servers.
26. What is the difference between iterative and recursive DNS queries?
Iterative and recursive describe two different behaviors a name server can take when it receives a query it can't fully answer itself.
In an iterative query, the server gives the best answer it currently has - often just a referral to another, more specific server - and leaves it to the querier to follow that referral itself. Root and TLD servers respond this way.
In a recursive query, the server takes full responsibility for getting a complete answer, making further queries (iteratively) to other servers on the client's behalf, and only replying once it has the final result. This is what a recursive resolver does for an end client.
| Aspect | Iterative query | Recursive query |
| Who follows referrals? | The original querier | The server itself |
| Typical responder | Root / TLD servers | Recursive resolver |
| Client effort | Higher - must chase referrals | Lower - gets one final answer |
27. Explain the DNS hierarchy from root to leaf?
DNS is organized as an inverted tree, and authority is delegated downward from the root at every level.
- Root zone - represented by a trailing dot; served by the 13 logical root server addresses, which know which servers handle each TLD.
- Top-level domain (TLD) -
.com,.org,.io, and country codes like.uk; TLD servers know which name servers are authoritative for each registered second-level domain. - Second-level domain - the registered name itself, like
exampleinexample.com; this is the zone most domain owners directly manage. - Subdomains - further labels to the left, like
wwworapi, which can have their own records or even be delegated to separate authoritative servers.
Each level only needs to know about the level directly below it, which is what makes DNS scalable - no single server anywhere needs a complete map of the entire namespace.
28. What is a NS record and how is it used?
An NS (name server) record identifies which name servers are authoritative for a zone - it's the mechanism DNS uses to delegate control of a namespace from one level to the next.
When a TLD server is asked about example.com, it doesn't know the site's IP address; it just returns the NS records for example.com, pointing the resolver to the actual authoritative servers, such as ns1.example.com and ns2.example.com.
NS records also make subdomain delegation possible: a parent zone can add NS records for eu.example.com pointing at a completely different set of name servers, effectively handing off management of that subtree to another team or system.
example.com. 86400 IN NS ns1.example.com. example.com. 86400 IN NS ns2.example.com.
29. Why is TTL important when planning a DNS migration?
During a migration - say, moving a website to a new hosting provider or IP address - TTL directly controls how quickly the change becomes visible everywhere, and how much traffic still lands on the old infrastructure after the cutover.
If the existing TTL is long (hours or a day), resolvers around the world may keep returning the old IP address long after the new one is live, which risks users hitting a decommissioned server.
The standard practice is to lower the TTL - often to something like 300 seconds - well before the change, wait long enough for the old, longer-TTL answer to expire everywhere, make the actual DNS change, and then raise the TTL back up afterward once the new value has propagated and been verified.
Skipping this step is one of the most common causes of "intermittent" issues during a cutover, where some users see the new site instantly and others keep hitting the old one for hours.
30. How do you troubleshoot a DNS resolution failure?
A structured approach saves time versus guessing, since a "site won't load" symptom can originate at several different layers.
- Confirm the failure is DNS, not connectivity, by running
dig example.comornslookup example.comand checking whether an answer comes back at all. - Query the authoritative server directly, bypassing local caches:
dig @ns1.example.com example.com. If this works but the normal lookup doesn't, the problem is upstream of the authoritative server (caching or propagation), not the zone itself. - Check the record actually exists and is correct in the zone - typos in the name, wrong record type, or an accidentally deleted record are common causes.
- Check TTL and propagation timing if a recent change was made; an old cached answer may simply not have expired yet.
- Verify delegation by confirming the parent zone's NS records match what the authoritative servers expect - a mismatch here causes hard-to-diagnose partial failures.
dig example.com A dig @ns1.example.com example.com A dig example.com NS
31. What is the difference between UDP and TCP in DNS?
DNS was designed around UDP because most queries and responses are small and speed matters more than guaranteed delivery for a single lookup - if a UDP packet is lost, the resolver just retries.
TCP is used instead when a response would be too large for a single UDP packet (historically 512 bytes, larger with EDNS0 extensions), which commonly happens with DNSSEC-signed responses or zone transfers between name servers (AXFR/IXFR), both of which always use TCP.
| Aspect | UDP | TCP |
| Typical use | Standard queries and responses | Large responses, zone transfers |
| Overhead | Low - no connection setup | Higher - connection handshake required |
| Reliability | Best-effort; client retries on loss | Guaranteed delivery |
| Common trigger | Default for A/AAAA/MX lookups | DNSSEC responses, AXFR/IXFR |
32. When should you use a CNAME record versus an A record?
The choice usually comes down to whether the target's IP address is stable and under your control, or managed by someone else and subject to change.
Use an A record when you control the server and its IP address directly - typically for the root/apex domain, since CNAMEs aren't allowed there, and for any subdomain pointing at infrastructure you manage yourself.
Use a CNAME record when pointing at a third-party service - a CDN, a SaaS platform, a load balancer - whose underlying IPs may change without notice. The provider updates their own DNS, and your CNAME automatically follows along without you needing to change anything.
A practical rule of thumb: if you'd have to update the record every time the target's infrastructure changes, a CNAME to a stable hostname is usually the better fit; if the IP genuinely won't change, an A record is simpler and slightly faster to resolve.
33. What is round-robin DNS and when would you choose it?
Round-robin DNS is a simple load-distribution technique where a single name has multiple A (or AAAA) records, each pointing to a different server, and the authoritative server returns them in a rotating order.
Different clients (or the same client on repeated lookups after cache expiry) tend to get different addresses first, which spreads traffic roughly evenly across the listed servers without needing any dedicated load-balancing hardware.
It's a reasonable choice for simple, low-stakes distribution - static content served from a few interchangeable servers, for example - but it has real limitations: it has no awareness of server health, so a downed server keeps receiving traffic until someone manually removes its record, and distribution isn't precisely even since clients and resolvers cache answers for the TTL duration.
For anything requiring health checks, weighted distribution, or fast failover, a dedicated load balancer or a DNS-based traffic-management service with health checking is the better fit.
34. How does DNS load balancing differ from a dedicated load balancer?
Both aim to spread traffic across multiple servers, but they operate at completely different points in a request's lifecycle and with very different levels of intelligence.
DNS-based load balancing works at the name resolution stage - it decides which IP address a client receives before any connection is even attempted, based on rules like round-robin order, geographic proximity, or periodic health checks against each candidate IP.
A dedicated load balancer sits in the actual traffic path, in front of the servers, and makes a per-connection or even per-request decision, with real-time awareness of server load and instant failover if a backend becomes unhealthy mid-session.
| Aspect | DNS load balancing | Dedicated load balancer |
| Decision point | At name resolution, before connection | In the live traffic path |
| Failover speed | Limited by TTL and client caching | Near-instant |
| Granularity | Per-lookup | Per-connection or per-request |
Many production systems use both together: DNS to route users to the nearest regional cluster, and a dedicated load balancer inside that region to distribute traffic across individual servers.
35. What is a glue record and why is it needed?
A glue record is an A (or AAAA) record supplied by a parent zone for a name server that is itself inside the child zone it's delegating - solving what would otherwise be a circular lookup problem.
Consider example.com delegating to ns1.example.com. To resolve example.com, a client needs the IP of ns1.example.com - but to resolve ns1.example.com normally, it would need to already know how to reach example.com's name servers. That's the circular dependency.
Glue records break the cycle by having the parent zone (here, the .com TLD servers) include the IP address for ns1.example.com directly alongside the NS referral, so the resolver gets everything it needs in one response without an extra circular lookup.
Glue is only required when a name server's hostname lives inside the zone it's serving ("in-bailiwick"); a name server hosted under a different domain, like dns.hostingprovider.com serving example.com, doesn't need glue because resolving it isn't circular.
36. Explain the execution flow of a DNS query from browser to response?
A single DNS lookup passes through several distinct caches and servers before a browser can open a connection. Here's the concrete path for a cold lookup of www.example.com:
sequenceDiagram
participant Browser
participant OS as OS Stub Resolver
participant Rec as Recursive Resolver
participant Root as Root Server
participant TLD as .com TLD Server
participant Auth as Authoritative Server
Browser->>OS: Resolve www.example.com
OS->>Rec: Query (cache miss locally)
Rec->>Root: Who handles .com?
Root-->>Rec: Referral to .com TLD servers
Rec->>TLD: Who handles example.com?
TLD-->>Rec: Referral to ns1.example.com
Rec->>Auth: What is the A record?
Auth-->>Rec: 93.184.216.34
Rec-->>OS: 93.184.216.34 (cached for TTL)
OS-->>Browser: 93.184.216.34
Browser->>Browser: Open TCP/TLS connection to IP
Each hop checks a local cache before going further out; the full walk shown here only happens when nothing along the chain has a valid, unexpired answer.
Once the browser has the IP address, DNS's job is done - the rest of the request (TCP handshake, TLS negotiation, HTTP exchange) proceeds independently of DNS entirely.
37. Explain the internal working of DNS caching across resolvers?
DNS caching isn't a single cache - it's a layered chain, and understanding how each layer independently tracks its own expiry is key to reasoning about propagation delays.
- Browser cache - many browsers keep a very short-lived internal DNS cache (often just a minute or two) independent of the OS, partly to reduce lookups within a single browsing session.
- OS stub resolver cache - the operating system typically caches answers for the record's TTL, shared across all applications on that machine.
- Recursive resolver cache - the ISP's or public DNS provider's resolver caches the answer for the full TTL, shared across potentially millions of users behind that resolver.
- Negative caching - even "this name doesn't exist" (NXDOMAIN) responses get cached, per the TTL specified in the zone's SOA record's minimum field, to avoid hammering authoritative servers with repeated failed lookups.
Because each layer decrements its own independent timer starting from when it first received the answer, two users behind different resolvers can see a DNS change at noticeably different times even with an identical TTL, simply because their caches were populated at different moments.
This is also why "flushing your DNS cache" only ever fixes the local machine's view - it has no effect on what upstream recursive resolvers, used by everyone else, still have cached.
38. What is DNSSEC and why does it matter?
DNSSEC (Domain Name System Security Extensions) adds cryptographic signatures to DNS records so a resolver can verify that an answer genuinely came from the zone's legitimate owner and wasn't tampered with in transit.
Plain DNS has no built-in authenticity check - a resolver has no way to know if a response was forged or altered by an attacker sitting on the network path, which is exactly the weakness behind cache-poisoning and spoofing attacks.
DNSSEC solves this by having each zone sign its records with a private key, publishing the corresponding public key via DNSKEY records, and chaining trust upward through DS records at the parent zone, all the way to a trusted root.
It matters most for protecting the integrity of the resolution chain itself - it doesn't encrypt DNS traffic or hide what's being queried, and it doesn't protect the connection made after resolution (that's TLS's job); it only guarantees that the answer you got is the one the zone owner actually published.
39. How does DNSSEC validation work?
DNSSEC validation lets a resolver confirm an answer's authenticity by walking a chain of cryptographic trust from the queried record all the way up to a trust anchor at the root.
- The authoritative zone signs its records with a private Zone Signing Key (ZSK), producing RRSIG records alongside the actual data.
- The zone's public key is published as a DNSKEY record, letting anyone verify the RRSIG signatures against the actual record data.
- The parent zone publishes a DS (Delegation Signer) record - a hash of the child zone's DNSKEY - proving the parent vouches for that specific key.
- This repeats up the chain: child DS is verified against parent DNSKEY, whose own DS is verified against its parent, until reaching the root zone, whose key is a globally trusted anchor built into validating resolvers.
If any link in this chain is missing, mismatched, or the signature doesn't verify against the actual data, a validating resolver returns a SERVFAIL rather than risk serving a forged answer - which is why DNSSEC misconfiguration (like an expired signature) causes a domain to go fully unreachable for validating resolvers rather than just showing a warning.
40. What is a DNS cache poisoning attack?
DNS cache poisoning (also called spoofing) is an attack where a malicious actor tricks a resolver into caching a forged answer, redirecting anyone who queries that resolver to an attacker-controlled IP address instead of the legitimate one.
Classically, this exploits the fact that DNS over UDP has limited ways to verify a response actually came from the server it was sent to - an attacker who can guess or observe a query's transaction ID and source port can race a forged response to arrive before the real one, and if it wins, the resolver caches it as if it were legitimate.
Once poisoned, every client using that resolver gets redirected for the duration of the forged record's TTL - which attackers often set artificially high to maximize the damage window.
Modern defenses include randomizing both the query's source port and transaction ID (making the guess much harder), and DNSSEC, which lets a resolver cryptographically reject a forged answer even if it does arrive first.
41. How does DNS over HTTPS (DoH) differ from DNS over TLS (DoT)?
Both DoH and DoT encrypt the DNS query itself, protecting it from being read or tampered with by anyone on the network path - something plain UDP/TCP DNS never provided. Where they differ is transport and how easily that traffic can be distinguished from other traffic.
DoT runs DNS over a dedicated TLS connection on its own well-known port (853), which keeps DNS traffic cleanly separated but also makes it easy for a network operator to identify and selectively block, since the port is distinctive.
DoH tunnels DNS queries inside regular HTTPS traffic on port 443, the same port used for ordinary web browsing, which makes DNS traffic much harder to distinguish from - and therefore block separately from - general web traffic.
| Aspect | DoT | DoH |
| Port | 853 (dedicated) | 443 (shared with HTTPS) |
| Blockability | Easier to identify and block by port | Harder to distinguish from regular web traffic |
| Typical consumer | Network-level resolvers, some OS settings | Browsers, apps |
Neither protocol changes what data is exchanged - both still leak the queried domain to whichever resolver you're using; they only protect the query in transit between the client and that resolver.
42. What is a DNS amplification attack?
A DNS amplification attack is a type of distributed denial-of-service (DDoS) attack that abuses open DNS resolvers to flood a victim with far more traffic than the attacker directly sends.
The attacker sends a small DNS query to an open resolver but spoofs the source IP address to be the victim's address instead of their own. The resolver, following normal protocol, sends its response - which can be many times larger than the original query, especially with EDNS0-extended or DNSSEC-signed responses - to that spoofed victim address.
By sending many such spoofed queries through many open resolvers simultaneously, an attacker with modest bandwidth can generate a disproportionately large flood of traffic aimed at the victim - the "amplification" is the ratio between the small request size and the much larger response size.
Mitigations include restricting resolvers to only answer recursive queries from known, trusted clients (rather than the whole internet), and network-level source-address validation (BCP 38) that prevents spoofed source IPs from leaving a network in the first place.
43. How can you optimize DNS performance for a global application?
For a globally distributed application, DNS optimization is mostly about reducing the physical and logical distance between a user and the answer, and about avoiding unnecessary resolution overhead.
- Use anycast DNS for your authoritative name servers so queries are automatically routed to the topologically nearest server instance, cutting round-trip time for users far from any single physical location.
- Set TTLs appropriately - long enough to maximize cache hits and reduce load on authoritative servers, but short enough to support failover or traffic-steering changes when needed; 300-3600 seconds is a common balance.
- Minimize CNAME chains, since each hop in a chain requires an additional resolution step; flattening to a direct A/AAAA record (or a provider's "ALIAS" equivalent) where possible reduces latency.
- Use geo-aware or latency-based DNS routing to return the IP of the regional deployment closest to the querying resolver, rather than a single global endpoint.
- Reduce the number of distinct hostnames a page depends on, since each unique hostname triggers its own separate DNS lookup on a cold cache.
None of these replace a CDN or a proper load balancer, but together they shrink the DNS portion of a request's total latency, which matters most for users on high-latency or high-round-trip-time connections.
44. What is anycast DNS and how does it improve reliability?
Anycast is a network routing technique where the same IP address is announced from multiple physical locations simultaneously, and standard internet routing (BGP) automatically directs each query to whichever announcing location is topologically closest to the sender.
flowchart TD
U1[User in Tokyo] -->|Query to shared anycast IP| N1[Nearest instance: Tokyo]
U2[User in London] -->|Query to same anycast IP| N2[Nearest instance: London]
U3[User in Sao Paulo] -->|Query to same anycast IP| N3[Nearest instance: Sao Paulo]
N1 --- ZoneData[(Identical zone data replicated to all instances)]
N2 --- ZoneData
N3 --- ZoneData
For DNS specifically, this means a domain's root or authoritative servers can be reachable at, say, dozens of physical sites worldwide under one address, and a user's query is naturally answered by a nearby instance without any special configuration on the client side.
Reliability improves in two ways: latency drops because queries travel a shorter physical distance, and resilience improves because if one anycast site fails or is overwhelmed (including during a DDoS attack), routing simply shifts traffic to the remaining healthy sites - the attack's impact is absorbed and spread out rather than taking down a single origin.
All 13 logical root name server addresses use anycast for exactly this reason, which is why the "13 root servers" actually correspond to well over a thousand physical machines globally.
45. Explain the lifecycle of a DNS record from creation to propagation?
A DNS record moves through several distinct stages between being created and becoming reliably visible to the whole internet.
flowchart LR
A[1. Record created/edited in zone file] --> B[2. SOA serial number incremented]
B --> C[3. Authoritative servers reload/sync via zone transfer]
C --> D[4. Record answered authoritatively on new queries]
D --> E[5. Old cached answers expire per previous TTL]
E --> F[6. Resolvers re-query and cache the new value]
F --> G[7. Fully propagated once all TTLs worldwide have expired]
- Creation/edit - a record is added or changed in the zone's authoritative source (zone file or DNS provider's UI/API).
- Serial increment - the zone's SOA serial number is bumped, signaling to secondary name servers that a zone transfer is needed.
- Sync - secondary/replica authoritative servers pull the updated zone, typically within seconds for modern providers.
- New authoritative answers - any resolver querying the authoritative server fresh now gets the new value immediately.
- Cache expiry - resolvers and clients that already cached the old value keep serving it until that record's previous TTL expires - this, not the sync step, is usually the real bottleneck.
- Re-query and full propagation - once every cache worldwide has expired its old entry and fetched the new one, the change is considered fully propagated, which can take anywhere from seconds to the length of the old TTL.
This is why "DNS propagation" is often misunderstood as a fixed, mysterious delay - it's really just the old TTL working itself out of every cache that happened to have the previous value.
46. What is split-horizon DNS and when would you use it?
Split-horizon (also called split-view) DNS serves different answers for the same domain name depending on where the query is coming from - typically, internal corporate network clients versus the public internet.
For example, app.example.com might resolve to a private internal IP address (like 10.0.5.20) for employees on the corporate VPN, while the exact same name resolves to a public-facing load balancer IP for anyone querying from outside.
This is implemented by running two logically separate views of the same zone on the name server infrastructure - one served to internal network ranges, one to everyone else - often using the same underlying software (like BIND's view statements) but distinct zone data per view.
It's most commonly used to give internal users direct, low-latency access to internal services without exposing those private addresses (or sometimes the service's existence at all) to the public internet, while still letting external users reach a public-facing version of the same-named service.
47. How do you troubleshoot slow DNS propagation after a record change?
"Slow propagation" almost always traces back to caching behavior rather than the DNS change itself failing, so troubleshooting focuses on isolating where the stale answer is still living.
- Verify the authoritative servers already have the new value by querying them directly:
dig @ns1.example.com example.com A. If this already shows the correct answer, the zone change succeeded and the delay is purely caching downstream. - Check the previous TTL that was in effect before the change - a long prior TTL (say, 86400 seconds) fully explains up to a day of visible delay for anyone who cached the old answer just before the change.
- Test from multiple public resolvers (Google's 8.8.8.8, Cloudflare's 1.1.1.1, an ISP's default) to see whether it's a global caching issue or isolated to one specific resolver holding a stubborn stale entry.
- Check for NS-level delegation mismatches - if the parent zone's NS records point to different servers than the ones actually serving updated data, some resolvers may keep querying an out-of-date authoritative source entirely.
- Rule out local/browser-level caching on the affected device specifically, since that's often unrelated to actual internet-wide propagation and can be cleared independently.
If step 1 shows the authoritative servers themselves are wrong, the issue isn't propagation at all - it's that the change wasn't actually applied or saved correctly.
48. What is the difference between DNSSEC and DoH/DoT in terms of what they protect?
These two security mechanisms are often confused because both are "DNS security" features, but they protect against completely different threats and don't overlap in what they guarantee.
DNSSEC protects the integrity and authenticity of the data itself - it lets a resolver cryptographically verify that an answer really came from the zone owner and wasn't altered, regardless of which transport carried it. It does nothing to hide the query from anyone watching the network.
DoH/DoT protect the confidentiality of the query in transit between the client and its chosen resolver - they encrypt the conversation so a network observer can't see which domains are being looked up. Neither verifies that the resolver's answer is actually correct or unaltered.
| Aspect | DNSSEC | DoH / DoT |
| Protects against | Forged/tampered answers | Eavesdropping on the query |
| Guarantees | Authenticity and integrity of data | Confidentiality in transit |
| Blind spot | Doesn't hide the query from observers | Doesn't verify answer authenticity |
Because they solve different problems, they're complementary rather than substitutes - a fully hardened setup uses DNSSEC to validate answers and DoH or DoT to keep the query itself private, and using only one leaves the other gap open.
49. What happens when a DNS server times out during resolution?
A timeout means a resolver sent a query and got no response within its configured wait window - which could stem from packet loss, an overloaded or unreachable server, or a network-level block.
A well-behaved recursive resolver doesn't just give up on the first timeout; it typically retries the same server briefly, then falls back to trying any other name servers it knows for that zone (if the zone has multiple authoritative servers listed), since a single unreachable server shouldn't fail the whole lookup.
If every known authoritative server for a zone times out, or the resolver's own upstream path is broken, the client-facing result is usually a SERVFAIL error, distinct from an NXDOMAIN (which means the name genuinely doesn't exist) - SERVFAIL specifically signals "I couldn't get a reliable answer," not "this name doesn't exist."
This is a core reason zones are configured with multiple authoritative name servers on different networks: a timeout hitting one doesn't need to become a full resolution failure as long as at least one other configured server is reachable and responsive.
50. Explain the internal working of a CDN's use of DNS for traffic routing?
A CDN uses DNS as its primary steering mechanism, deciding which of many geographically distributed edge servers a given user's request should reach - all before a single byte of actual content is transferred.
Instead of returning one fixed A record, a CDN's authoritative name servers typically respond dynamically per query, most often through one of these approaches:
- Anycast - the same IP address is announced from every edge location, and internet routing (BGP) naturally sends each user to the nearest one; DNS just returns one constant anycast IP, and the network layer does the actual steering.
- Geo-based/latency-based DNS - the CDN's name server inspects the querying resolver's location (via its IP) and returns the A record for the edge cluster judged closest or fastest for that resolver.
- CNAME chaining - a customer's domain (via a CNAME) points at a CDN-managed hostname, which the CDN can then resolve dynamically without the customer needing to change anything when the CDN adjusts its own infrastructure.
Because this decision happens at the DNS layer, it's also how CDNs perform fast-ish failover: if an edge location becomes unhealthy, the CDN's DNS layer (or the anycast routing table) simply stops directing new lookups there, and traffic shifts to the next-best location - constrained, as always, by how long previously cached answers linger on client TTLs.
This is precisely why CDN setup instructions almost always involve a CNAME rather than a static A record: it hands the CDN provider ongoing control over exactly which edge IP a customer's domain resolves to.