This post is to document the process to migrate DHCP service from Windows Server 2016 to Windows Server 2022, as well as the related DHCP Failover and DHCP Forwarding/IP-helper configuration. Microsoft’s DHCP services haven’t changed much in the past 20 years, it would be a similar procedure if you are using the old version such as Server 2008, Server 2012.
- Source: The DHCP service is hosted on the Windows Server 2016
- Destination: A couple of Server 2022 running DHCP failover with load balancing.
- Lease time (DHCP Option) on the Source server is configured to 2 hours prior to the schedule of the change window.
Migrate the DHCP Server from Windows Server 2016 to Windows Server 2022
1. On Source 1: Server 2016, open the DHCP console and clean up the inactive scopes, then export the DHCP Scope out, via run CMD as Administrator then
netsh dhcp server export C:\temp\dhcp.dat all
2. If your destination server is a brand new build and has nothing on it, you just need to install the DHCP server roles and “authorize” this server in the domain, in the below example my server has been authorized already.
3. If there are some scopes already configured on the destination DHCP server, we would suggest cleaning up the DHCP configuration. as of the source DHCP server, It would be great to remove the “inactive scopes” that sit there doing nothing.
4. Setup pre-defined DHCP options such as option 150 for Cisco IP phones or customized DHCP options for Cisco Access Points etc, otherwise you may encounter errors like below and bring down the DHCP service. You can find an example of DHCP Option 150 in our post here: https://ictfella.com/how-to-migrate-dhcp-service-from-cisco-core-switch-to-server-2022
5. Copy the exported “dhcp.dat” and import it on the new server, please run CMD as administrator to avoid any permission-related issues.
netsh dhcp server import c:\temp\dhcp.dat all
DHCP failover Configuration (Optional)
1.Right-click on the migrated Score and select “Configure Failover…”
2. By default the scope is ticked, click Next
3. Click “Add Server”, then choose your authorized secondary DHCP server, if your server is NOT in the list, please “authorize” your secondary server first.
4. Setup your failover relationship’s load balance configurations, you can “Enable Message Authentication”, then next
5. Review the config, then finish the failover configuration
DHCP Forward / IP Helper Configuration
Cisco switch IP helper-address, update/modify the IP helper configuration
conf t interface Vlan2 ! get rid of old config no ip helper-address 192.168.0.1 no ip helper-address 192.168.0.2 ! put new servers into config ip helper-address 10.0.0.1 ip helper-address 10.0.0.2 end wr
Juniper Switch DHCP forwarding
set forwarding-options dhcp-relay forward-snooped-clients all-interfaces set forwarding-options dhcp-relay overrides allow-snooped-clients del forwarding-options dhcp-relay server-group dhcp-srv 192.168.0.1 del forwarding-options dhcp-relay server-group dhcp-srv 192.168.0.2 set forwarding-options dhcp-relay server-group dhcp-srv 10.0.0.1 set forwarding-options dhcp-relay server-group dhcp-srv 10.0.0.2 set forwarding-options dhcp-relay active-server-group dhcp-srv set forwarding-options dhcp-relay group all interface irb.2
How to use the Netsh utility to export and import DHCP scopes
Step-by-Step: Configure DHCP for Failover
Configuring the Cisco IOS DHCP Relay Agent