This article provides information on how to migrate an existing DHCP server deployment on Windows Server 2008 or Windows Server 2008 R2 to Windows Server 2012 DHCP Failover.
DHCP Failover feature requires two Windows Server 2012 on which the DHCP role is installed. To migrate from an existing DHCP server deployment to use DHCP Failover in Windows Server 2012 is a four step process-
Windows Server 2012 has new DHCP server PowerShell cmdlets which include export/import based on PowerShell. To export the DHCP server configuration, scopes and leases from a Windows Server 2008 or Windows Server 2008 R2 DHCP server (say named win2k8r2-dhcp.corp.contoso.com), run the below command from the new Windows Server 2012 powershell console.
Export-DhcpServer –ComputerName win2k8r2-dhcp.corp.contoso.com -Leases -File C:\export\dhcpexp.xml -verbose
In case one doesn’t wish to export lease information, leave out the –Leases switch from the command.
Since PowerShell provides remoting functionality, this command when run from Windows 8 client (with DHCP RSAT installed) or Windows Server 2012 computer with the -ComputerName switch being that of a Windows Server 2008 or Windows Server 2008 R2 computer running DHCP server, would be able to export and fetch all data from the remote server successfully.
After running this command successfully, the DHCP server configuration on the source server, including server level configuration, scopes present on the server, and the associated configuration and leases will be exported to the file dhcpexp.xml.
Using the DHCP server Windows PowerShell import, the DHCP server configuration can be now be imported on the Windows Server 2012 DHCP server (say named DHCP1.corp.contoso.com) using the following command:
Import-DhcpServer –ComputerName DHCP1.corp.contoso.com -Leases –File C:\export\dhcpexp.xml -BackupPath C:\dhcp\backup\ -Verbose
If you wish to migrate specific scopes (e.g. 10.1.1.0, 10.1.2.0) to the Windows Server 2012 DHCP server instead of migrating all the scopes, you can use the following import command:
Import-DhcpServer –ComputerName DHCP1.corp.contoso.com -Leases –File C:\export\dhcpexp.xml -BackupPath C:\dhcp\backup\ -Verbose –ScopeId 10.1.1.0, 10.1.2.0
The above mentioned import command should be run only on the Windows Server 2012 DHCP server (DHCP1) which is intended to be the primary server for the failover relationship.
When a failover relationships is set up between two Windows Server 2012 DHCP servers (DHCP1 and DHCP2), the failover setup wizard (or cmdlet) replicates the scopes and associated configuration on the second server (DHCP2). Hence, the scopes are not required to be imported on the second server (DHCP2).
However the failover setup wizard (or cmdlet), does not replicate server level configuration to the second DHCP server. If there is a server level configuration present on the existing DHCP server deployment, which include:
These server level configuration options must be imported on the second DHCP server (DHCP2). To import only server level configuration on the partner server DHCP2, use the following command:
Import-DhcpServer –ComputerName DHCP2.corp.contoso.com –File C:\export\dhcpexp.xml –ServerConfigOnly –verbose –BackupPath C:\dhcp\backup\
The switch –ServerConfigOnly achieves the desired objective of just importing the server-level settings.
After having migrated all server-level and scope settings on the primary server and migrated only server-level settings on the partner server, one can now configure a DHCP Failover relationship between the two servers. Refer to the links at the end of this post to understand more about deploying DHCP Failover.
Configurations like the DHCP relay agents for all the subnets/scopes being migrated need to be configured with IP addresses of the two Windows Server 2012 DHCP servers in the failover relationship so that the DHCP client messages are relayed by the relay agent to both the DHCP servers. Please refer the documentation of your DHCP relay agent for details on how to update the DHCP relay agent with IP addresses of the DHCP servers.
We hope this blog post eases migration of existing DHCP Server deployments to the new Windows Server 2012 DHCP server and enables deployment of DHCP Failover. As always, your feedback and comments are most appreciated.