Migrate DHCP HA KB ID 0001826
Problem
I got an email last week.
“Hi thanks for your video. I have two win 2012 DC DHCP on a failover/load balance config and want to migrate to new Win 2022 VMs. What’s the exact procedure? If it’s a single VM it’s easy but I’m not sure about if it’s on a failover setup.”
Well migrating the domain controller element I’ve covered before.
Migrate From Server 2012 to Server 2022 Domain Controllers
And Migrating stand-alone DHCP servers is easy.
Migrate DHCP Scope(s) to Windows Server 2022
But what if you have your DHCP servers deployed in HA – be that Load Balanced, or Hot Standby (failover)?
How do you migrate DHCP to a new platform then ?
Solution: Migrate DHCP HA
There was very little information I could find on this subject, you can drop down to one DHCP server and perform a simple migration to Server 2022 then setup HA again of course, but I think the following solution is much more elegant, and there’s NO DOWNTIME to worry about.
Windows Migrate DHCP HA – Step 1 Remove HA
In my example I have some 2012 R2 Servers running DHCP (it does not matter if they are in Load balancing mode or Hot Standby, the approach is the same just the commands will vary.
I’ve got two new Windows Server 2022 servers updated and added to the domain ready to take on the DHCP HA roles.
The first thing I’m going to do is remove the failover partnership. You can do this on either of the legacy DHCP servers but the one you run the command on will be the DHCP server that remains operational after you remove the partnership (in this case 2012-dhcp-1.dingdong.com).
Use the following syntax, the first command gets the failover groups name, you then delete that failover group.
[box]
Get-DHCPServerv4Failover
Remove-DHCPServerv4Failover "Failover-Group-Name"
[/box]
Windows Migrate DHCP HA – Step 2 Uninstall DHCP
Go to the server you have just removed the partnership from, it will not be performing DHCP but still has the role installed.
To Remove DHCP from the redundant legacy server use the following PowerShell commands. WARNING the last command will reboot the server.
[box]
Uninstall-WindowsFeature DHCP Uninstall-WindowsFeature RSAT-DHCP Restart-Computer
[/box]
Windows Migrate DHCP Failover – Step 3 Create HA to Server 2022
We will now create a failover partnership to the first of our two new Windows Servers.
Firstly we need to install the DHCP role on BOTH of our new Windows Servers, register them in AD, and change a registry key to stop server manager bugging you about running the DHCP setup wizard.
[box]
Install-WindowsFeature DHCP -IncludeManagementTools netsh dhcp add securitygroups Add-DhcpServerInDC -DnsName 2022-DHCP-1.dingdong.com -IPAddress 192.168.110.18 Set-ItemProperty –Path registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ServerManager\Roles\12 –Name ConfigurationState –Value 2
[/box]
NOW CARRY OUT THE NEXT STEP ON THE REMINING LEGACY DHCP SERVER
To create a Load Balanced Failover partnership (with a 50/50 load balance) use the following syntax. (change the values in red accordingly).
[box]
Add-DhcpServerv4Failover –ComputerName “2012-DHCP-1.dingdong.com” –PartnerServer “2022-DHCP-1.dingdong.com” –Name “DHCP-LOAD-BALANCE” –LoadBalancePercent 50 -MaxClientLeadTime 1:00:00 -StateSwitchInterval 00:45:00 -ScopeId 192.168.110.0 -SharedSecret “Password123"
[/box]
To create a Hot Standby (failover) partnership, use the following command instead.
[box]
Add-DhcpServerv4Failover -ComputerName “2012-DHCP-1.dingdong.com” –PartnerServer “2022-DHCP-1.dingdong.com” -Name “DHCP-HOT-STANDBY” -ServerRole Active -ReservePercent 10 -MaxClientLeadTime 1:00:00 -StateSwitchInterval 00:45:00 -ScopeId 192.168.110.0 -SharedSecret “Password123“
[/box]
Windows Migrate DHCP Failover – Step 4 Break Replication
If you are replicating many scopes then wait a while for the servers to be ‘in sync’, the next step seems counter intuitive, as you are going to delete the very thing you have just created, but this procedure is carried out on the NEW DHCP SERVER NOT THE LEGACY ONE, (so the DHCP scope is removed from the last remaining legacy DHCP server.)
On the first new DHCP server execute the following commands. (same commands you used above in step 1).
[box]
Get-DHCPServer4Failover
Remove-DHCPServer4Failover "Failover-Group-Name"
[/box]
Windows Migrate DHCP HA – Step 5
Now just as you did in step 2, remove the DHCP role form the last remaining legacy DHCP server.
Again, use the following commands. WARNING the last command will reboot the server.
[box]
Uninstall-WindowsFeature DHCP Uninstall-WindowsFeature RSAT-DHCP Restart-Computer
[/box]
Windows Migrate DHCP Failover – Step 6 Deploy new DHCP HA Configuration
Lastly, we setup a new failover relationship that is setup the same as the one we setup in step 3, but this time with the last remaining new DHCP server.
Like so.
[box]
Add-DhcpServerv4Failover –ComputerName “2022-DHCP-1.dingdong.com” –PartnerServer “2022-DHCP-2.dingdong.com” –Name “DHCP-LOAD-BALANCE” –LoadBalancePercent 50 -MaxClientLeadTime 1:00:00 -StateSwitchInterval 00:45:00 -ScopeId 192.168.110.0 -SharedSecret “Password123"
[/box]
You can now migrate any remaining roles or applications form the old servers, remove them from the domain and decommission them.