Windows · DNS Server

Windows DNS Server

Windows DNS Server is the role that turns names into addresses for an entire network, and because Active Directory refuses to start without it, the zone types, dynamic update rules, and scavenging settings covered here are core infrastructure, not background plumbing.

Quick idea: Windows DNS Server answers two questions for every computer on the network — what is this name’s address, and who else offers this service — and every zone, record, and setting on the role exists to answer those questions correctly, quickly, and only for clients who are allowed to ask.
DNS Server service

The Windows Server role that answers queries, hosts zones, and accepts dynamic updates.

Zone

A portion of the DNS namespace stored and administered as a unit, such as corp.example.com.

Resource Record

A single entry in a zone — an A record, an MX record, an SRV record — answering one kind of query.

What Is Windows DNS Server?

DNS is the industry-standard protocol that maps computer names to IP addresses. In Windows Server, DNS is installed as a server role, and every Windows computer — client or server — runs a matching DNS Client service that queries it. When you build a new Active Directory forest, DNS is installed automatically alongside it, because AD has nowhere else to publish itself.

Think of DNS as an enormous, constantly updated phonebook, and Windows DNS Server as the phonebook company an organisation runs for its own staff, rather than trusting someone else’s directory. Each phonebook chapter is a zone, each entry is a resource record, and the DNS Server service is the company printing, indexing, and correcting those chapters as people join, move desks, or leave.

Windows DNS Server does not require Active Directory. It runs perfectly well as a standalone resolver hosting public lookup zones, and plenty of organisations run it that way. What changes with AD in the picture is how the zone data itself is stored and replicated — covered in Zone Types below.

How DNS Resolution Works

A DNS client normally sends a recursive query: it hands the DNS server a name and expects a final answer, success or failure, with no further work on its side. The DNS server that receives a recursive query does the legwork, issuing its own iterative queries against other servers until it has an answer or exhausts the search.

Resolving www.contoso.com from scratch might mean the local DNS server asks a root server, gets referred to the .com name servers, asks them, and gets referred again to the name servers authoritative for contoso.com — each of those being an iterative query — before it can finally answer the client’s single recursive request. A forwarder short-circuits this: if configured, the server sends unresolved queries straight to an upstream resolver instead of walking the root hierarchy itself. Root hints are only used once forwarders fail to respond.

Answers are cached along the way. Each resource record carries a Time to Live (TTL), and both the DNS server and the client’s own resolver cache honour it, serving repeat queries from memory until the TTL expires rather than re-querying every time.

Why Run Your Own DNS Server?

AD Integration

Active Directory publishes and discovers itself entirely through DNS records it controls.

Caching & Control

Answers for internal names come from a server you administer, with no external dependency.

Private Namespaces

Internal-only names never need to exist on the public internet at all.

An organisation could point every machine at a public resolver and never run its own DNS server — except that a public resolver has never heard of corp.example.com, cannot accept dynamic updates from your clients, and cannot enforce who is allowed to update which record. Running the role internally is what makes private namespaces, dynamic registration, and Active Directory discovery possible at all.

This is the layer Active Directory is built on. Every domain join, logon, and replication cycle starts with a DNS query for a service record, and the discovery mechanics themselves — SRV records, the DC locator process, the LDAP ping — are covered in depth in AD Part 8: DNS & Active Directory. This post stays one layer down, at the DNS Server role itself.

Practical rule: Caching is what keeps DNS traffic off the wire. A resolver that answers a repeat query from its own cache never touches the network at all — which is also why a TTL set too low quietly increases both query volume and server load without anyone changing a record.

DNS Zone Types

A zone is the unit of authority — a DNS server is authoritative for a name only if it loads the zone containing that name. Windows Server supports several zone types, and picking the right one is mostly about how the data should be replicated and updated.

Zone Type Description
Primary The writable, authoritative copy of a zone. Stored as a text file under %systemroot%\System32\Dns unless it is Active Directory-integrated.
Secondary A read-only copy pulled from a master server by zone transfer (AXFR/IXFR). Provides redundancy without a second writable copy.
Stub Holds only the NS, SOA, and glue A records for a zone — enough to keep delegation current without hosting the full record set.
Active Directory-integrated Zone data lives inside AD DS itself, in the ForestDnsZones or DomainDnsZones application partitions, and replicates via normal AD replication rather than zone transfers.
Conditional forwarder Not a zone of records at all — a per-namespace rule sending queries for one specific domain to specific upstream servers.

Active Directory-integrated zones are the default for a reason. Because every domain controller running DNS holds a writable copy, there is no single point of failure for updates and no separate zone-transfer topology to maintain — the zone simply rides the same multi-master replication that carries the rest of the directory. It is also the only zone type that supports secure dynamic update, covered next.

Installing and Configuring DNS Server

The role installs the same way as any other Windows Server feature, through Server Manager or PowerShell, and does not require a reboot.

# Install the DNS Server role
Install-WindowsFeature -Name DNS

# Find the IP address to bind the server to
Get-NetIPAddress | fl IPAddress,InterfaceAlias

# Restrict the server to listen on one interface only
$DnsServerSettings = Get-DnsServerSetting -All
$DnsServerSettings.ListeningIpAddress = @("10.10.0.10")
Set-DnsServerSetting $DnsServerSettings

# Point unresolved queries at internal forwarders instead of the internet root
Set-DnsServerForwarder -IPAddress "10.10.0.1","10.10.0.2"

# Create a standard primary zone (file-based)
Add-DnsServerPrimaryZone -Name "corp.example.com" -ZoneFile "corp.example.com.dns"

# Create an Active Directory-integrated zone, replicated to every DC in the domain
Add-DnsServerPrimaryZone -Name "corp.example.com" -ReplicationScope "Domain"

# Add a conditional forwarder for a partner organisation's namespace
Add-DnsServerConditionalForwarderZone -Name "partner.example.com" -MasterServers 10.20.0.5,10.20.0.6
Important: Root hints are never fully removed — Windows Server does not support deleting the last one. If a server should never walk the internet root hierarchy, disable recursion entirely rather than emptying the root hints list; disabling recursion also disables any configured forwarders.

Dynamic Updates

By default, a Windows client registers its own host (A) and pointer (PTR) records the moment it gets an IP address, and refreshes them roughly every 24 hours. This is what makes DHCP-assigned addresses usable in DNS without anyone hand-editing records.

Standard file-based zones do not accept dynamic updates unless you explicitly enable them, and even then the updates are unauthenticated — any client can attempt to overwrite an existing record. Active Directory-integrated zones behave differently: once a zone becomes AD-integrated, Windows Server defaults to secure dynamic update only, negotiated over Kerberos, so only an authorised computer account can register or modify its own name.

Default TTLs vary by what registered the record: 10 minutes for records the Netlogon service registers on a domain controller, 15 minutes for records the DHCP Client service registers, and 20 minutes for records the DNS Server service registers for its own zones. These are short on purpose — a wrong record should not linger in caches for long.

Aging and Scavenging

Dynamic update adds records automatically. It has no equivalent mechanism to remove them when a computer disappears from the network without deregistering cleanly — a laptop that loses power, a decommissioned server, a VM that was simply deleted. Left alone, these become stale records: entries that answer queries with information that stopped being true.

Aging and scavenging solves this with two clocks per zone. The no-refresh interval is a window, seven days by default, during which the server ignores refresh attempts for a record it has just timestamped — this exists purely to cut down on write traffic. Once that window closes, the refresh interval begins, also seven days by default, during which the record can still be refreshed. Only after both intervals pass without a refresh does a record become eligible for scavenging.

# Enable scavenging on the DNS server, checking every 7 days
Set-DnsServerScavenging -ScavengingState $true -ScavengingInterval 7.00:00:00 -ApplyOnAllZones

# Enable aging on a specific zone with the default 7-day intervals
Set-DnsServerZoneAging -Name "corp.example.com" -Aging $true -RefreshInterval 7.00:00:00 -NoRefreshInterval 7.00:00:00

# Stamp every existing record in a zone with a current, non-zero timestamp
# (needed once, after converting an existing zone to use aging)
dnscmd /ageallrecords corp.example.com /f
Important: Aging and scavenging is disabled by default, and Microsoft’s own guidance is blunt about why: get the intervals wrong and the server will delete records that are still in use, and anyone — even on a zone restricted to secure updates — can then create that name and take ownership of it. Set no-refresh and refresh intervals well above 24 hours, since every statically-configured Windows client refreshes daily regardless of DHCP. For what stale records actually look like once they have already caused an outage, see Stale DNS Records After a Domain Controller Decommission.

PowerShell & Command-Line Reference

Beyond installation and zone setup, these cover day-to-day record management, verification, and cache control.

# Add a host (A) record, with an associated PTR record created automatically
Add-DnsServerResourceRecordA -ZoneName "corp.example.com" -Name "app01" -IPv4Address "10.10.0.50" -CreatePtr

# List every zone hosted on this server and how it is stored
Get-DnsServerZone | Select-Object ZoneName, ZoneType, IsDsIntegrated

# List every record of a given type in a zone
Get-DnsServerResourceRecord -ZoneName "corp.example.com" -RRType A

# Resolve a name using the client resolver (PowerShell equivalent of nslookup)
Resolve-DnsName -Name "app01.corp.example.com" -Type A

# Query a specific DNS server directly, bypassing the client's configured servers
nslookup app01.corp.example.com 10.10.0.10

# Clear the local resolver cache after a record changes
Clear-DnsClientCache

# Force this machine to re-register its own DNS records
ipconfig /registerdns

# Run the DNS-specific health checks on a domain controller
dcdiag /test:dns /DnsBasic
Healthy output: After a record change, Resolve-DnsName against the authoritative server should return the new value immediately; if a client elsewhere still shows the old one, the cause is almost always its own resolver cache or TTL, not the DNS server — Clear-DnsClientCache on that client settles it.

DNS Resource Record Types

Record Purpose
A / AAAAMaps a hostname to an IPv4 or IPv6 address.
CNAMEAliases one name to another canonical name.
MXPoints a domain at the mail servers that accept its email, in preference order.
PTRMaps an IP address back to a name, rooted in the in-addr.arpa reverse zone.
SRVAdvertises a service — host, port, priority, weight — such as an AD domain controller.
NSNames the authoritative servers for a zone, and drives delegation between zones.
TXTFree-text data, commonly used for domain ownership or policy verification.
SOAThe first record in every zone, naming the primary server and the zone’s aging/refresh values.

Troubleshooting Cheat Sheet

Symptom Likely Cause Fix
Records disappear within a day or two of registration No-refresh and refresh intervals set below 24 hours, so scavenging outruns the client’s own daily refresh. Set both intervals to at least 7 days with Set-DnsServerZoneAging.
A record vanishes right after an IP address change on an AD-integrated zone The client sends a delete for the old record and a registration for the new one; because both DNS servers are already synced, the delete replicates and removes the new registration too. Known behaviour of AD-integrated replication timing — re-run ipconfig /renew and confirm the record settles after replication converges.
A record disappears the moment a AAAA record registers DHCP Option 81 clients on ISATAP or 6to4 adapters send an update with TTL 0 for the A record while registering the AAAA record. Stop dynamically updating DNS from tunnelling adapters, or disable Option 81 handling for them.
DNS queries hang or time out intermittently A configured forwarder or root hint server is unreachable. Verify forwarder reachability, remove dead entries, or temporarily enable Disable recursion to isolate the problem.
Event ID 4004 or 4013: “DNS server was unable to open Active Directory” The DNS Server service started before AD DS was ready on that domain controller. Let AD DS finish starting, then restart the DNS Server service; investigate further if it recurs on every boot.
Secondary zone stops updating from its primary The secondary is not listed on the primary’s zone transfer allow list, or TCP 53 is blocked between them. Add the secondary’s IP under the zone’s Zone Transfers tab and confirm TCP 53 is open both ways.
Client’s dynamic update is silently rejected The zone accepts secure updates only, and the client is not a domain-authenticated computer account. Join the machine to the domain, or deliberately reconfigure the zone’s dynamic update setting if that is not possible.

Final Thoughts

Windows DNS Server rarely gets its own maintenance window. It sits underneath everything else, gets configured once during a domain build, and is then mostly forgotten — right up until a scavenging interval set too aggressively deletes a production record, or a forwarder goes dark and every outbound query starts timing out.

Treat the zone type, dynamic update setting, and aging configuration as deliberate decisions rather than installer defaults. They are cheap to get right up front and expensive to diagnose once records start behaving strangely across an entire domain.

Key takeaway: Run Get-DnsServerZone to confirm zones are Active Directory-integrated where they should be, and Get-DnsServerScavenging to confirm aging is enabled with sane intervals. If both check out, most of the failure modes in the troubleshooting table above are already ruled out.
Next in this series

Next, we can look at DNSSEC and DNS policies — the security and traffic-shaping layer that sits on top of every zone covered here.