In this tutorial, I’ll show you step by step instructions for setting up DNS aging and scavenging on Windows DNS Servers.
What is DNS Aging and Scavenging?
It is a Windows DNS Server feature that will automate the cleanup of stale dynamically registered DNS records.
- DNS Scavenging will only remove records based on their timestamp.
- DNS scavenging will not remove statically configured records. These are records manually created or changed from DDNS to static.
- DNS scavenging is not enabled by default
Do I really need to enable DNS Scavenging?
It depends, in small environments with little or no change it’s probably not a big deal. In medium to large environments I’d recommend turning this feature on, DNS can become a big mess and result in name resolution problems if stale DNS records are not cleaned up.
How to Configure DNS Aging and Scavenging on Server 2016
In this tutorial I’m using a Windows 2016 server, these steps will work on other server versions (2008 – 2019).
Step 1: Check Server DNS Records (Very Important First Step)
If you don’t follow this step first you could end up deleting server DNS records and that would be very BAD. As a precaution, you may want to also backup your DNS server and or records.
Scavenging works on timestamps, so any DNS record with a timestamp will get processed and possibly deleted. So I recommend you check your server DNS records and make sure they are static.
To check your records open the DNS console and check the Timestamp column, your servers should be set to static.
You can see below my DHCP1 server has a timestamp and is not static. I will need to fix this.
The fix is simple just open the record then uncheck the box “Delete this record when it becomes stale”
Now when I refresh my DNS console the timestamp shows static for this record.
Check all your server records and change them to static before moving on to the next step.
Step 2: Set Scavenging on the DNS Zone
1. Open the DNS Console
2. Right Click on the zone you want to enable scavenging on and click properties
3. Click the Aging button
4. Now click the box “Scavenge stale resource records”
No-refresh interval is the amount of time that must elapse before a DNS client or DHCP server can refresh a timestamp for a record.
Refresh interval is the amount of time that a record is allowed to remain in the DNS database after its timestamp has been refreshed.
The combined duration of these two intervals determines how long a record can exist in the DNS database before it is scavenged. For example, above I have both intervals set to 7 days, this means a record can exist for up to 14 days before it is scavenged.
The combination of no-refresh interval and refresh interval should be equal to or less than your DHCP lease duration.
For example, if your DHCP lease duration is 14 days then you would set both intervals to 7 days.
If your DHCP lease duration is 8 days then you would set both intervals to 4 days.
That completes setting up aging for the zone. Now it needs to be turned on the server.
Step 3: Set Scavenging/Aging on the DNS Server
1. Open the DNS Console
2. Right click the DNS server
3. Click the “Advanced Tab” Then click “Enable automatic scavenging of state records”
That completes the setup of DNS aging and scavenging.