Dynamic DNS Update in Windows and Windows Server | Microsoft Learn
Dynamic update allows DNS client computers to register and update their resource records with a DNS server whenever changes occur. This feature reduces the need for manual administration of zone records, especially for clients that frequently move or change locations and use DHCP to obtain an IP address.
The DNS Client and Server services support dynamic update, as described in RFC 2136. The DNS Server service can enable or disable dynamic updates on a per-zone basis. By default, the Windows Server DNS Client service dynamically updates host (A) resource records in DNS when configured for TCP/IP. The DNS Server service is configured to allow only secure dynamic updates by default.
Protocol overview
RFC 2136 introduces the UPDATE message format, which allows adding and deleting resource records in a specified zone while checking for prerequisite conditions. The update is atomic, meaning all conditions must be met for the update to occur.
The zone update must be committed on a primary DNS server for that zone. The secondary DNS server forwards an update using the replication topology until it reaches the primary DNS server. When you use an Active Directory-integrated zone, an update for a resource record in a zone can be sent to any DNS server running on an Active Directory domain controller whose data store contains the zone.
When a zone transfer process starts, it locks the zone. This lock ensures that a secondary DNS server receives a consistent view of the zone while transferring the data. During this time, the zone can't accept dynamic updates. If the zone is large and frequently locked for transfers, it can starve dynamic update clients and cause system instability. To avoid this issue, Windows Server DNS Server service queues update requests that arrive during the zone transfer and processes them after the transfer is complete.
How computers update their DNS names
By default, computers that are statically configured for TCP/IP attempt to dynamically register host (A) and pointer (PTR) resource records for IP addresses configured and used by their installed network connections. All computers register records based on their FQDN.
DNS clients don't attempt dynamic update of the following items:
-
Over a remote access or virtual private network (VPN) connection. To modify this configuration, you can modify the advanced TCP/IP settings of the particular network connection or modify the registry.
-
Top-level domain (TLD) zones. Any zone named with a single-label name is considered a TLD zone, for example,
com,edu,blank,my-company.
Also by default, the primary DNS suffix portion of a computer’s FQDN is the same as the name of the Active Directory domain to which the computer is joined. To allow different primary DNS suffixes, a domain administrator can create a restricted list of allowed suffixes by modifying the msDS-AllowedDNSSuffixes attribute in the domain object container. A domain administrator can manage the attribute using Active Directory Service Interfaces (ADSI) or the Lightweight Directory Access Protocol (LDAP). Dynamic updates can be sent for any of the following reasons or events:
-
An IP address is added, removed, or modified in the TCP/IP properties configuration for any one of the installed network connections.
-
At startup time, when the computer is turned on.
-
A member server is promoted to a domain controller.
-
An IP address lease changes or renews with the DHCP server any one of the installed network connections, for example, when the computer is started or if the
ipconfig /renewcommand is used. -
The
ipconfig /registerdnscommand is used to manually force a refresh of the client name registration in DNS.
Important
If you use ipconfig /registerdns, the DNS client service attempts to directly register its DNS record, bypassing the DHCP server. This registration occurs even if the DHCP server is configured to Always dynamically update DNS A and PTR records. If the client doesn't have permission to update its resource record, the registration silently fails. If the DNS client has this permission, the resource record is updated. Permissions can be reset such that the DHCP server is no longer able to perform future updates on the resource record. The recommended method to update DNS registration for DHCP clients running Windows is to use ipconfig /renew. Don't use ipconfig /registerdns.
When one of the previous events triggers a dynamic update, the DNS Client service sends updates. This trigger is designed so that if a change to the IP address information occurs, corresponding updates in DNS are performed to synchronize name-to-address mappings for the computer. The DNS Client service performs this function for all network connections used on the system, including connections not configured to use DHCP.
This update process assumes that installation defaults are in effect for servers running Windows Server. Specific names and update behavior is tunable where advanced TCP/IP properties are configured to use nondefault DNS settings.
In addition to the full computer name (or primary name) of the computer, connection-specific DNS names can be configured and optionally registered or updated in DNS.
How dynamic update works
Dynamic updates are typically requested when either a DNS name or IP address changes on the computer. For example, suppose a client named oldhost is first configured with the following names:
-
Computer name:
oldhost -
DNS domain name:
example.contoso.com -
Full computer name:
oldhost.example.contoso.com
In this example, no connection-specific DNS domain names are configured for the computer. Later, the computer is renamed from oldhost to newhost, resulting in the following name changes on the system:
-
Computer name:
newhost -
DNS domain name:
example.contoso.com -
Full computer name:
newhost.example.contoso.com
After the name change is applied in System properties, you're prompted to restart the computer. When the computer restarts Windows, the DNS Client service performs the following sequence to update DNS:
- The DNS Client service sends an SOA type query using the DNS domain name of the computer.
The client computer uses the currently configured FQDN of the computer (such as newhost.example.contoso.com) as the name specified in this query.
- The authoritative DNS server for the zone containing the client FQDN responds to the SOA-type query.
For standard primary zones, the primary server (owner) returned in the SOA query response is fixed and static. It always matches the exact DNS name as it appears in the SOA resource record stored with the zone. If the zone being updated is directory-integrated, any DNS server running on a domain controller for the Active Directory domain in the FQDN can respond. It can dynamically insert its own name as the primary server (owner) of the zone in the SOA query response.
- The DNS Client service then attempts to contact the primary DNS server.
The client processes the SOA query response for its name to determine the IP address of the DNS server authorized as the primary server for accepting its name. It then proceeds to perform the following sequence of steps as needed to contact and dynamically update its primary server:
-
It sends a dynamic update request to the primary server determined in the SOA query response.
-
If the update succeeds, no further action is taken.
-
If this update fails, the client next sends an NS-type query for the zone name specified in the SOA record.
-
When it receives a response to this query, it sends an SOA query to the first DNS server listed in the response.
After the SOA query is resolved, the client sends a dynamic update to the server specified in the returned SOA record.
-
If the update succeeds, no further action is taken.
-
If this update fails, then the client repeats the SOA query process by sending a request to the next DNS server listed in the response.
-
After the primary DNS server that can perform the update is contacted, the client sends the update request and the DNS server processes it.
The contents of the update request include instructions to add A (and possibly PTR) resource records for newhost.example.contoso.com and remove these same record types for oldhost.example.contoso.com, the name that was previously registered.
The DNS server also checks to ensure that updates are permitted for the client request. For standard primary zones, dynamic updates aren't secured, so any client update attempt succeeds. For Active Directory–integrated zones, updates are secured and performed using directory-based security settings. For more information, see the Secure dynamic update section later in this article.
Dynamic updates are sent or refreshed periodically. By default, computers send a refresh once every seven days. If the update results in no changes to zone data, the zone remains at its current version and no changes are written. Updates result in zone changes or increased zone transfers only when names or addresses change.
Names aren't removed from DNS zones if they become inactive or aren't updated within the refresh interval (seven days). DNS doesn't have a mechanism to release or tombstone names. However, DNS clients try to delete old name records when a new name is applied. DNS clients also attempt to update name records when an address change occurs.
When the DNS Client service registers A and PTR resource records for a computer, it uses a default caching Time To Live (TTL) of 15 minutes for host records. This TTL determines how long other DNS servers and clients cache a computer’s records when they're included in a query response.
Time to Live
Whenever a dynamic update client registers in DNS, the associated A and PTR resource records include the Time to Live (TTL). By default, the TTL is set to 10 minutes for records registered by the Netlogon service. For records registered by the DHCP Client service, the TTL is set to 15 minutes. If the DNS Server service dynamically registers records for its own zones, the default TTL is 20 minutes. You can change the default setting in the registry. A small value causes cached entries to expire sooner, which increases DNS traffic but decreases the risk of cached records becoming outdated. Expiring entries quickly is useful for computers that frequently renew their DHCP leases. Long retention times are useful for computers that renew their DHCP leases infrequently.
Resolving name conflicts
When the DNS Client service attempts to register an A record, it checks if the authoritative DNS zone already contains an A record for the same name but with a different IP address. By default, the DNS Client service attempts to replace the existing A record (or records) with the new A record containing the IP address of the DNS client. As a result, any computer on the network can modify the existing A record unless secure dynamic update is used. Zones that are configured for secure dynamic update allow only authorized users to modify the resource record.
You can change the default setting so that the DNS Client service ends the registration process and logs the error in Event Viewer, instead of replacing the existing A record. For more information, see the Secure dynamic update section later in this article.
DNS and DHCP
Windows DNS clients are dynamic update-aware and can initiate the dynamic update process. A DNS client negotiates the process of dynamic update with the DHCP server when the client leases an IP address or renews the lease. This negotiation determines which computer updates the A and PTR resource records of the client. The DNS client and DHCP server negotiate who updates the records. The client and server send dynamic update requests to the primary DNS servers that are authoritative for the names to be updated.
The Windows Server DHCP Server service can update DNS records for clients that don't support the DHCP Client service FQDN option. This functionality can be enabled in the DNS tab of the server properties for the DHCP console. The DHCP server first obtains the name of legacy clients from the DHCP REQUEST packet. It then appends the domain name given for that scope and registers the A and PTR resource records.
In some cases, stale PTR, or A resource records can appear on DNS servers when the lease of a DHCP client expires. For example, when a DNS client tries to negotiate a dynamic update procedure with a DHCP server, the DNS client must register both A and PTR resource records itself. Later, if the client is improperly removed from the network, the client can't deregister its A and PTR resource records and they become stale.
If a stale A resource record appears in a zone that allows only secure dynamic updates, no computer is able to register any other resource record for the name in that A resource record. To prevent problems with stale PTR and A resource records, you can enable the aging and scavenging feature. For more information about the aging and scavenging feature, see DNS aging and scavenging.
To provide fault tolerance for dynamic updates, consider Active Directory integration for those zones that accept dynamic updates from Windows clients. To speed up the discovery of authoritative DNS servers, you can configure each client with a list of preferred and alternate DNS servers that are primary for that directory-integrated zone. If a client fails to update the zone with its preferred DNS server because the DNS server is unavailable, the client can try an alternate server. When the preferred DNS server becomes available, it loads the updated, directory-integrated zone that includes the update from the client.
Dynamic update process
In this section, we describe the dynamic update process for DHCP clients, statically configured clients, remote access clients, and multihomed clients.
DHCP client process
To initiate the dynamic update process, the DHCP client sends its FQDN to the DHCP server in the DHCPREQUEST packet by using the DHCP Client service FQDN option. The DHCP server then replies to the DHCP client by sending a DHCP acknowledgment (DHCPACK) message that includes the FQDN option (option code 81).
The following table lists the fields of the FQDN option of the DHCPREQUEST packet.
| Field | Explanation |
| --- | --- |
| Code | Specifies the code for this option (81). |
| Len | Specifies the length, in octets, of this option (minimum of 4). |
| Flags | Can be one of the following values: 0. Client wants to register the A resource record and requests that the server update the PTR resource record. 1. Client wants server to register the A and PTR resource records. 3. DHCP server registers the A and PTR resource records regardless of the request of the client. |
| RCODE1 and RCODE2 | The DHCP server uses these fields to specify the response code from the A and PTR resource records registrations performed on the client’s behalf and to indicate whether it attempted the update before sending DHCPACK. |
