If you are working in an organization that hosts its own DNS server where you have the records for MX, Web and other servers that are accessible externally, you must put a plan for how to rebuild your DNS server in case of failure or a disaster.
In this article, I am going to show you how to backup the zones in your DNS server and restore those using DNSCMD command lines; DNSCMD is a part of Support tools. So you must install the support tools in order to run this command.
I am going to simulate the case, by backing up a production DNS server and restore it to a virtual machine image. After installing the support tools on the server go to:
Start -> programs -> windows support tools -> command prompt
The syntax for our command is: dnscmd [ServerName] /zoneexport ZoneName ZoneExportFile
So based on my server and zone names, I will use the following syntax:
C:\>dnscmd MyDNSname /zoneexport TestZone.com TestZone.com.bak
You will notice that the output of this command is:
DNS Server MyDNSname exported zone
TestZone.com to file %windir%\system32\dns\ TestZone.com.bak
DNS server Command completed successfully.
Now you have to browse to the specified path and copy the .bak file, which we will use it to restore the zone to a different server.
- On the new server which supposes to be as a new one, install the DNS service and don't create any new zone.
- Paste the .bak file on %systemroot%\system32\dns and rename the extension to .dns
- Go to DNS management console, right click forward lookup zone and choose new zone, Next, Next, give it the same name, then next, make sure to choose the second choice, it should take the name of the zone automatically.
Now check your zone, it should contain your old records.
Note: In my case, the DNS server is a member server setting on the DMZ zone so the option to have active directory integrated zone is not available. One more thing, the previous exercise is valid in case of corrupted zone or you need to do some modifications on a specific zone, this will get your zone back before the changes.