Windows: Migrate DHCP HA

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.

DHCP Failover Migration 2012 to 2022

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).

 

DHCP HA Migration to Server 2022

Use the following syntax, the first command gets the failover groups name, you then delete that failover group.

Get-DHCPServer4Failover
Remove-DHCPServer4Failover "Failover-Group-Name"

Deploy DHCP HA with Powershell

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.

DHCP HA Migration PowerShell Uninstall DHCP

To Remove DHCP from the redundant legacy server use the following PowerShell commands. WARNING the last command will reboot the server.

Uninstall-WindowsFeature DHCP
Uninstall-WindowsFeature RSAT-DHCP
Restart-Computer

Remove DHCP Migrate DHCP HA

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.

DHCP Failover Migration Create New Failover

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.

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

Windows 2022 Install DHP via PowerShell Migrate DHCP HA

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).

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"

Windows 2022 Create DHCP Failover Load Balance

To create a Hot Standby (failover) partnership, use the following command instead.

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

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.)

DHCP Failover Migration 2012 to 2022 Migrate DHCP HA

On the first new DHCP server execute the following commands. (same commands you used above in step 1).

Get-DHCPServer4Failover 
Remove-DHCPServer4Failover "Failover-Group-Name"

Windows 2022 Delete DHCP Failover Load Balance

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.

DHCP HA Migration 2022 Remove DHCP

Again, use the following commands. WARNING the last command will reboot the server.

Uninstall-WindowsFeature DHCP
Uninstall-WindowsFeature RSAT-DHCP
Restart-Computer

Uninstall DHCP with Powershell

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.

DHCP HA Migration 2012 to 2022

Like so.

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"

Deploy DHCP HA with Powershell

You can now migrate any remaining roles or applications form the old servers, remove them from the domain and decommission them.

 

Related Articles, References, Credits, or External Links

Configure DHCP for Failover

Author: PeteLong

Share This Post On

6 Comments

  1. This is great. The only thing that I would want to do is to keep the same IP addresses as my old DHCP servers so that I don’t have to make any config changes in my routers/firewalls. How would I do this?

    Post a Reply
    • If you’re using DHCP helpers etc in you network – simply add the new 2022 server(s) to the config before you start. Or if you don’t want to do that Move the IP addresses of the OLD DHCP server to the new DHCP servers – the servers will need a reboot to re-register their DNS records after you change the IP address though.

      Post a Reply
      • So, once I migrate to the 2022 servers, all I need to do is change the local IP address of the server and reboot? That simple?

        Post a Reply
  2. If using/migrating a large number of scopes – can the -scopeid parameter just be omitted from the Add-DhcpServerv4Failover command and will that replicate all of the scopes for failover?

    Post a Reply
  3. Hi, Pete Long, when i had removed existing dhcp partnership between (primary dhcp1 and secondary dhcp2) 2012 server i can see all the scope got disappear from secondary DCHP2 server and i added new 2022 DCHP01 server and configured failover, but now i want to remove old primary server to this relationship, but its primary one so i believe once i removed it from failover now again New DHCP01 will loose the IP scopes.

    and also please confirm do we have other options available like avaya 242 and option 78, because i cant see them in 2022 DHCP server

    Post a Reply

Submit a Comment

Your email address will not be published. Required fields are marked *