Windows Server: How to Configure DNS Aging and Scavenging

Windows Server: How to Configure DNS Aging and Scavenging


Article Summary: This article provides information on configuring DNS aging and scavenging in Windows Server.


As discussed in Information about DNS Aging and Scavenging, aging and scavenging provide a means for the automatic removal of old and unused ("stale") records from the DNS database, significantly reducing the work required to keep the database up to date. If not correctly configured, however, aging and scavenging can cause more problems than they solve.

To configure DNS aging and scavenging in Windows Server, the following high-level steps must be performed:

  1. Set the aging and scavenging properties of the zone to be scavenged.
    Alternatively, set the aging and scavenging properties of a server. You then have the option of applying these properties to all Active Directory-integrated zones hosted on the server.
    Note: Aging and scavenging properties applied to a server will not apply to standard primary zones, which must have their aging and scavenging properties configured per zone.
  2. Set the scavenging interval and enable scavenging on the server.

To configure the aging and scavenging properties of a zone, perform the following steps:

  1. In the DNS Manager console, right-click the appropriate zone and select Properties.
  2. In the General tab of the zone's properties window, click the Aging button.
  3. Check the Scavenge stale resource records box and set the no-refresh and refresh intervals for records in the zone. Note that the earliest time that records in the zone may be scavenged will be displayed. Click OK when finished.
  4. Click OK to close the zone's properties window.

To configure the aging and scavenging properties of all Active Directory-integrated zones on a server, perform the following steps:

  1. In the DNS Manager console, right-click the appropriate server and select Set Aging/Scavenging for All Zones...
  2. Check the Scavenge stale resource records box and set the no-refresh and refresh intervals. Click OK when finished.
  3. The confirmation dialog will list the settings that will apply to all Active Directory-integrated zones created in the future. Check the box labeled Apply these settings to the existing Active Directory-integrated zones to apply them to existing zones. As noted above, these settings will not apply to any standard primary zones on the server. Click OK to confirm the settings.

Even though the scavenging properties have now been configured, scavenging must be enabled on the server before it can occur. To enable scavenging on a server, perform the following steps:

  1. In the DNS Manager console, right click the appropriate server and select Properties.
  2. In the Advanced tab of the server's properties window, check the Enable automatic scavenging of stale records box and set the scavenging period.
  3. Click OK to close the properties window.

The first scavenging pass will occur when the scavenging period has expired. It is also possible to manually initiate a scavenging pass at any time by right-clicking the server in the DNS console and selecting Scavenge Stale Resource Records.


It is also possible to configure aging and scavenging from the command line.

To set the aging and scavenging properties of a zone via the command line, perform the following steps:

  1. Open an elevated command prompt on the DNS server.
  2. Type dnscmd /config <zone> /norefreshinterval <interval> to set a zone's no-refresh interval.
    <zone> : The name of the zone. Specify ..AllZones (case-sensitive, and the two initial periods are required) to apply the setting to all zones on the server.
    <interval> : The desired no-refresh interval in hours. The default value is 168 (7 days).
  3. Type dnscmd /config <zone> /refreshinterval <interval> to set a zone's refresh interval.
    <zone> : The name of the zone. Specify ..AllZones (case-sensitive, and the two initial periods are required) to apply the setting to all zones on the server.
    <interval> : The desired refresh interval in hours. The default value is 168 (7 days).
  4. Type dnscmd /config <zone> /aging to enable a zone to be scavenged.
    <zone> : The name of the zone. Specify ..AllZones (case-sensitive, and the two initial periods are required) to apply the setting to all zones on the server.

To set the default aging and scavenging properties of new zones on a server, perform the following steps:

Note: Properties configured with the following commands will apply to all zones created after the commands are run. See above for instructions on applying a particular setting to all existing zones on the server.
  1. Open an elevated command prompt on the DNS server.
  2. Type dnscmd /config /defaultnorefreshinterval <interval> to set the default no-refresh interval.
    <interval> : The desired no-refresh interval in hours. The default value is 168 (7 days).
  3. Type dnscmd /config /defaultrefreshinterval <interval> to set the default refresh interval.
    <interval> : The desired refresh interval in hours. The default value is 168 (7 days).
  4. Type dnscmd /config /defaultagingstate <value> to enable or disable scavenging on new zones.
    <value> : Either 0 (scavenging disabled) or 1 (scavenging enabled).

To set the server's scavenging interval and enable scavenging, perform the following steps:
  1. Open an elevated command prompt on the DNS server.
  2. Type dnscmd /config /scavenginginterval <interval> to set the scavenging interval.
    <interval> : The desired scavenging interval in hours. Setting this value to 0 (zero) will disable scavenging on the server.

There are two more scavenging-related commands worth mentioning here:
  • dnscmd /ageallrecords <zone> : If scavenging is enabled on the server and the specified zone, this command will add a timestamp to all records in the zone (or a subtree of the zone) and set the value of the timestamp to the current time. This makes those records eligible to be scavenged, though they won't be scavenged right away; their no-refresh and refresh intervals have to expire first, as always. Be aware that this command affects static records (effectively turning them into dynamic records, as far as scavenging is concerned) and that once a timestamp is added to a record, the only way to remove it is to delete and recreate the record manually. Name server (NS), start-of-authority (SOA), and WINS records are not affected by this command.
  • dnscmd <server> /startscavenging : The command initiates a scavenging pass on the specified server, as long as scavenging is enabled on that server. If no server is specified, the local server is used.




Article ID: SLN290798

Last Date Modified: 10/10/2018 11:25 AM


Rate this article

Accurate
Useful
Easy to understand
Was this article helpful?
Yes No
Send us feedback
Comments cannot contain these special characters: <>()\
Sorry, our feedback system is currently down. Please try again later.

Thank you for your feedback.