Migrating DHCP servers is actually quite easy to do and isn't that complicated. If in a situation where you have multiple DHCP servers for failover, it doesn't take that long as you only need to migrate one server and set the rest as failover and by doing that it will automatically replicate the settings.
I'm personally a big fan of using Server Core because of it's low footprint and the amount of updates there are compared to the desktop version. So this guide will mostly involve powershell commands, but can be used with the desktop experience installed as well
I'm assuming you already installed your flavor of Windows Server OS and it's all ready to install some roles.
- Use Powershell to install the DHCP role using the following command:
Install-WindowsFeature DHCP –IncludeManagementTools
- Connect to your current DHCP server and start up powershell, then enter the following command:
Export-DhcpServer -ComputerName "currentdhcpserver.mydomain.com" -Leases -File "C:\currentdhcp.xml" –Verbose
This will export the your DHCP server configuration to the file currentdhcp.xml - Copy the currentdhcp.xml file to the C:\ drive of the new server
- On the new server, create a new folder called DHCPBackup
- On the new server using powershell, use the following command:
Import-DhcpServer -Leases –File "C:\currentdhcp.xml" -BackupPath "C:\DHCPBackup" –Verbose
This will import the configuration you exported in step 2 and make a backup of the DHCP server on the new server should anything go wrong so you can revert back if needed
You have now migrated your DHCP server!
To finish it all up I suggest you do the following
- If you use DHCP relaying on your router, either configure the router to route DHCP traffic to the new server or configure the server with the same IP as your old DHCP server
- On your old DHCP server, disable the DHCP Server services. Using powershell:
Stop-Service "DHCP Server"
At this point, leave it all running for a week or so, check if there's anything weird going with DHCP. - If step 2 went smoothly, you can start decomissioning the old DHCP server.
Use
to uninstall the management consoleUninstall-WindowsFeature RSAT-DHCP
Use
to uninstall DHCP server itselfUninstall-WindowsFeature DHCP -Remove
What If I have more than 1 DHCP server and need failover?
- You simply spin up another Windows Server and install the DHCP role on it.
- Start the DHCP Management tool and if needed connect to the new server
- Right-click on the server name and click Authorize
- In the same DHCP Management Tool, right-click the DHCP node and click Add Server and add your migrated server
- In the node of your migrated server, right-click your scope and select Configure Failover...
- When it asks for the partner server, enter the name or IP address of the failover server
- Give your failover sync a name you can easily recognize
- Under mode, you can configure the server to load balance or hot standby. Depending on your network setup, choose one or the other.
Do this for every scope you have and you will have failover between two DHCP servers.