Microsoft DNS Migration

There are many ways to migrate DNS server. Ways include creating a new DNS server, replicating to the new server, promoting as the new primary and so on. For this demonstration I will do an alternative clean migration without any replication.

The reason why I did my migration this was was because of two reasons.
1. Migrating from Windows Server 2003 x86 to Windows Server 2008R2 x64
2. Changing Public IP addresses of the name servers.
3. Our Public IP addresses for all 10K Zones needs to be changed. Huge.

Task
1. Copy zones to new server
2. Copy registry file to new server
3. Edit registry for use with new server and IP
4. Edit Zones to use with new IP and new SOA
5. Import Registry
6. Test local resolution
7. Change GLU Records on Name Server Domain Names
8. Edit Load Balancers to add new servers

Assumptions and example IP addresses
1. New server is stood up with dns services installed.
Old Server Primary Hostname: OldDns-01
Old Server Secondary Hostname: OldDns-02
New Server Primary Hostname: NewDns-01
New Server Secondary Hostname: NewDns-02


Internal IP of Old DNS Primary Server: 10.10.10.1
Internal IP of Old DNS Secondary Server: 10.10.10.2
External IP of Old DNS Primary Server: 64.256.20.6
External IP of Old DNS Secondary Server: 64.256.20.7


Internal IP of New DNS Primary Server: 10.10.10.11
Internal IP of New DNS Secondary Server: 10.10.10.12
External IP of New DNS Primary Server: 207.66.240.6
External IP of New DNS Secondary Server: 207.66.240.7

There’s many ways to do this. Here’s just another way…


I. On new DNS Server copy .DNS Zones from OLD DNS Server to New DNS Server DNS directory:
– Robocopy \\OldDns-01\c$\windows\system32\dns %systemroot%\System32\DNS /E
II. On old DNS Server export registry key:
– HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DNS (Server 2003)
– They now moved this in server 2008+ to
– HKML\Software\Microsoft\Windows NT\CurrentVersion\DNS Server
III. Copy Exported Registry to new DNS Server.
IV. Edit Exported Registry Key with Notepad.
– Find and Replace 10.10.10.2 with 10.147.20.12
– The above step replaces all Notify Secondaries/Notify Servers of Secondary DNS server to the new secondary Server IP address.
V. Use Notepad ++, do a “Find in Files” (CTRL+Shift+F).
– Find/Replace the following: in Directory %Systemroot%\System32\DNS
– 64.256.20.6 Replace with 208.93.240.69
– 64.256.20.7 Replace with 208.93.240.70
– I won’t include the details but I had to find/replace for all the old IP to new ip for all the zones. We only have 9 Unique Ip’s so change is small but to a lot of zones.

VI. Again Use Notepad ++, do a “Find in Files” (CTRL+Shift+F).
– Find/Replace the following: in Directory %Systemroot%\System32\DNS
• Make sure you search using Regular expression for this task…
– Find: [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] ; serial number
– Replace with: 2010050307 ; serial number
– This set’s the Serial to use the date I migrated on 7th revision.
– Find: Zone version: [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]
– Replace with: Zone version: 2010050307
– This sets Zone Version to Today’s Date Format.
VII. Now that The Zones have the new IP address and SOA changed, we can import the edited Registry key into the new DNS server.
VIII. Restart DNS Services.
IX. Now you should see all 9300 Zones appear in DNS Management Console. Due to the fact that this is a standalone DNS server rather than an AD integrated DNS Server we will have to manually add the zones in the secondary DNS server for replication to successfully occur. Once the zones are manually added to secondary DNS server first time, Zone Changes replicate successfully.
X. On New DNS server issue: Dir %systemroot%\system32\dns *.dns > c:\DNSList.TXT
XI. Grab DNSList.TXT and Edit in Text Editor.
XII. Delete everything but the DOMAINNAME.XXX
XIII. Search Replace using Regular expression.
– Find ^ replace with dnscmd /zoneadd
– Find $ replace with /secondary 10.10.10.11
– Results should look like:
– dnscmd /zoneadd domain1.com /secondary 10.10.10.11
– dnscmd /zoneadd domain2.COM /secondary 10.10.10.11
– dnscmd /zoneadd domain3.com /secondary 10.10.10.11
– dnscmd /zoneadd domain4.com /secondary 10.10.10.11
– dnscmd /zoneadd domain5.net /secondary 10.10.10.11
XIV. Save Above as a batch File and run on NewDns-02.
XV. Now all your zones should propagate onto the secondary DNS Server.
XVI. Just to Be Safe Restart DNS Service on Both 01 and 02 Nodes. Propagation on Secondary will take some time.
XVII. Spot Check all settings on DNS Management Console, Registry and Zone (.DNS) File to make sure all required changes are complete.
XVIII. Do a NSLookup, Server NewDns-01. Query a hand full of records. Check SOA using set type=SOA.

Now go to your registrar and change your Name servers domains Glue Record. This should be the record that points to your external IP addresses for your Primary and secondary Name Servers.