When you migrate a DHCP Server to another server, what you need to move is the database and server settings. These are the basic components of the DHCP Server.
Of course, depending on the needs and infrastructure of an enterprise, you may need to make even more changes such as setting up routers to use the new DHCP Server, etc. Obviously, this is something you need to include in your own your plan as I can not cover all these cases in an article.
For migrations from Windows 2008/2008 R2 and 2012/2012 R2 versions of Windows Server, you can use the Netsh command line tool. For Windows Server 2012/2012 R2 and 2016 versions, it is recommended to use PowerShell for migrating the DHCP Server.
Since it is an asynchronous way of migrating settings from one DHCP Server to another, that means there will be a downtime, at least small, until all the steps are completed.
A general practice followed in such cases is what I will describe immediately in the following scenario.
Suppose we have two DHCP Servers, DHCP01 and DHCP02. We will export the settings from DHCP01 and then import them to DHCP02.
DHCP01 should stop responding to client requests and take over DHCP02 entirely. We assume that the DHCP Server role is installed on both servers.
DHCP Server Migration, how it’s done
After connecting to the existing DHCP Server, DHCP01 in our example, open PowerShell, and export the settings.
Export-DhcpServer -ComputerName DHCP01 -File "C:\DHCP-Config.xml" -Force |
Once completed, transfer the file that will be created to the new DHCP Server, DHCP02.
Next, you will need to stop sharing IP addresses from the existing server so that the newcomer will take over soon. This can be done in two basic ways, either to stop the DHCP Service or to unauthorize it. The choice is yours, as the case may be.
For example, you can stop the DHCP Service via PowerShell with the following command.
Stop-Service -Name DHCPServer |
Set-Service -Name DHCPServer -StartupType "Disabled" |
Or through the Services console. You should also set the Startup type to Disabled so that it does not automatically start for any reason.
Log in to the new DHCP Server and make sure the DHCP Server service is already running. With PowerShell, this is done in seconds.
Get-Service -Name DHCPServer |
Next, import the settings you extracted from the “old” DHCP Server.
Import-DhcpServer -ComputerName DC02 -File "C:\DHCP-Config.xml -Force |
Once completed, you can authorize the new DHCP Server so that it is now operational on your infrastructure.
At this point, you will need to check that all scopes, server options, etc. have been introduced, and that clients are normally receiving IP settings from the new DHCP Server.
When everything is working properly, reconnect to the old DHCP Server and remove the corresponding role to completely remove it from your infrastructure.
This is how a basic migration process of the DHCP Server is completed. I hope I helped.
Hello,
We have two dhcp servers.
dhcp1
dhcp2
Both are Windows server 2016
We want to merge all scopes to be on dhcp2 only.
What process do you suggest?
What about the leases? can those be exported from 2012r2 and imported on a new 2012r2 DHCP server?
In reply to Michael Christensen:
If you add the -leases command you can include the leases
Current Import-DhcpServer command makes -BackupPath a required parameter.
After moving everything to the new server no clients get the DHCP and when I turn on the old server all the clients start working. What am I missing?
I get (in PS:administrator) ‘export’ is not recognized as the name of a cmdlet, function, script file or operable program…
I completed the migration and everything looked fine on the new server. I authorized the new server and unauthorized and stopped dhcp services on the old. I connected a computer that was not running before the migration and it did not get a new lease. I moved back to the original server and the computer got an address. Is there a time period before the new dhcp server address is handed out? Is there a way to check this?
Update your info, doesn’t work
1. Build a New VM and Join to the domain
2. From the Old DHCP server ” Check to ensure DHCP is working as it should” If all is OK move to the next step
3. Old DHCP – Make a Note of the IP address details
4. OLD DHCP – Create a folder called ” dhcpdata ”
5. OLD DHCP – run cmd as administrator
6. OLD DHCP – from cmd run ” netsh dhcp server export C:\dhcpdata\olddhcp.dat All ” This will backup all information in the OLD DHCP environment.
7. Copy the “dhcpdata” folder and it contents to the NEW VM C:\ This is the server that will be using for the NEW DHCP server
8. OLD DHCP – Unauthorize the OLD DHCP – This is optional
9. OLD DHCP – Stop the service ” DHCP Server ” – Important to avoid conflicts
10. OLD DHCP – remove the IP configuration from the server if no other service is running on the server – Important Optional if you want to re-use the same local IP address for the new DHCP server. Go to Network Connections —- Local Ethernet that is been used and set IPv4 to automatically, do the same for the DNS also ( You should already have a note of this IP address from step 3 )
11. NEW DHCP – From the new VM re-IP to the IP from step 3 ( Ensure all changes is done and you can ping from the DC’s with the new VM name. once done move on
12. NEW DHCP – ADD the DHCP Server Role and Authorize the new VM on your domain for DHCP once all done
13. NEW DHCP – run cmd as an Administrator
14. NEW DHCP – from cmd run ” netsh dhcp server Import C:\dhcpdata\olddhcp.dat All ” This will restore all information from your OLD DHCP environment to the new DHCP environment.
15. Check and test
16. Done
This all can be done without seeing any down time
1. Build a New VM and Join to the domain
2. From the Old DHCP server ” Check to ensure DHCP is working as it should” If all is OK move to the next step
3. Old DHCP – Make a Note of the IP address details
4. OLD DHCP – Create a folder called ” dhcpdata ”
5. OLD DHCP – run cmd as administrator
6. OLD DHCP – from cmd run ” netsh dhcp server export C:\dhcpdata\olddhcp.dat All ” This will backup all information in the OLD DHCP environment.
7. Copy the “dhcpdata” folder and it contents to the NEW VM C:\ This is the server that will be using for the NEW DHCP server
8. OLD DHCP – Unauthorize the OLD DHCP – This is optional
9. OLD DHCP – Stop the service ” DHCP Server ” – Important to avoid conflicts
10. OLD DHCP – remove the IP configuration from the server if no other service is running on the server – Important Optional if you want to re-use the same local IP address for the new DHCP server. Go to Network Connections —- Local Ethernet that is been used and set IPv4 to automatically, do the same for the DNS also ( You should already have a note of this IP address from step 3 )
11. NEW DHCP – From the new VM re-IP to the IP from step 3 ( Ensure all changes is done and you can ping from the DC’s with the new VM name. once done move on
12. NEW DHCP – ADD the DHCP Server Role and Authorize the new VM on your domain for DHCP once all done
13. NEW DHCP – run cmd as an Administrator
14. NEW DHCP – from cmd run ” netsh dhcp server Import C:\dhcpdata\olddhcp.dat All ” This will restore all information from your OLD DHCP environment to the new DHCP environment.
15. Check and test
16. Done
This all can be done without seeing any down time