從 Windows 2008 R2 轉移 DNS Service 到 Windows 2012 R2

問題描述

因舊實體機不堪使用,所以打算將原主機 DNS Service 轉移到新建 Windows 2012 R2 虛擬主機。









解決方式

我們可以使用簡單的批次檔將原有的設定匯出並轉移到 Windows 2012 R2。


一、Export DNS 登錄值到備份.reg檔並複製 C:\windows\system32\DNS 內所有檔案到特定資料夾。


批次檔內容如下:
mkdir c:\temp\DNSConfig
mkdir c:\temp\DNSConfig\reg
mkdir c:\temp\DNSConfig\data
reg export HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DNS c:\temp\DNSConfig\reg\dns.reg /y
reg export "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DNS Server" c:\temp\DNSConfig\reg\dnsserver.reg /y
xcopy %systemroot%\System32\dns c:\temp\DNSConfig\data /e /y




二、將 DNSConfig 資料夾複製到目的主機的 c:\temp 下,準備還原 DNS Service 到新建虛擬主機(注意: xcopy的來源路徑最後含".")

批次檔內容如下:
net stop dns
reg export c:\temp\DNSConfig\reg c:\temp\DNSConfig\reg\dns.reg
reg export c:\temp\DNSConfig\reg c:\temp\DNSConfig\reg\dnsserver.reg
xcopy c:\temp\DNSConfig\data\. %systemroot%\System32\dns /e /y
net start dns


三、用系統管理員身分開啟命令提示字元視窗並執行批次檔,檢視各項設定是否正常。





心得與觀察

產出的.reg檔內容會與 Windows 2012 R2 有差異,但仍然可以移轉成功。
不過,最好還是用在同版本的伺服器轉移,這樣可避免很多問題發生。
如果發生無法啟動 DNS Service 時,最快的方式是用同樣 Windows 2012 R2 Domain Controller 的 DNS Server 登錄檔覆蓋,然後刪除 DNS 主控台內主機並重加。




參考資料

1. Windows 2003 Server的DNS Server 轉移方式

留言

熱門文章