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.
This is sick! So Simple!
aboutu time MS catches up with world but this attempt is still not an enterpise solution - MS once again behind the market leaders in IPAM
Thanks Joe for the feedback. Could you please share specifics on aspects that you are looking for from an enterprise perspective.
Could you please share specifics on aspects that you are looking for from an enterprise perspective.
We have a lot of well defined DHCP scopes that cover geographic locations on our local campus as well as our remote sites. The limit of 31 failover relationships seems low. We have a scope for each network closet and each floor. Scopes are a class C for each area, for example Floor1 North, Floor1 East, Floor1 South, Floor1 West. x 7 floors. Then the same deal for a 4 story building next door and we're over 31.
I understand that there may have been a design consideration that led to this limit, but I was wondering if there is a way to modify a reg key, etc to increase the limit of 31.
Am I typing out the FQDN in the <brackets> after the -ComputerName switch? Or does the FQDN go in place of "ComputerName" ?
Thanks Rusty for sharing your deployment information.
From your description, I am not sure if you need a large number of failover relationships. In a single failover relationships, you can have MULTIPLE scopes. In fact, there is no upper bound on the number of scopes in a single failover relationship - we have tested till 10,000 scopes in a single failover relationship.
Does that help or did I misunderstand your deployment need still.
Usage example -
You don't need the angle brackets. Will get the example in the blog corrected.
Thanks team for wonderful article. Do we have here a migration from single server to 2012 load balance dhcp server? This will be perfect :)
After following the steps in this article, you can configure load balance failover using the steps mentioned in the failover step by step guide at technet.microsoft.com/.../hh831385.aspx if you are using DHCP MMC. If you are using DHCP PowerShell, you can use the steps mentioned at blogs.technet.com/.../dhcp-failover-using-powershell.aspx to do the same via command line.
Great article thank you v much. Quick q - If you are consolidating numerous DHCP Scopes from server 2008, into 2 server 2012 boxes setup in a failover.... when you export the configs from the old dhcp servers & import them 1-by-1 into server 2012, does it MERGE the configs, or overwrite with each import?
Import-DhcpServer will merge the configurations as long as there is no conflict. The conflict situations could be:
- the target server already has a value for an option and the import file contains a different value for the same option.
- the scope being imported already exists on the target DHCP server
In such cases of conflict, the Import-DhcpServer will retain the configuration on the target DHCP server and log a warning to the console reporting the conflict.
For the case of scope already existing, you can use the -OverWrite switch to overwrite the scope on the target DHCP server.
Suggest to use the -Verbose swtich to get the detailed logging from this cmdlet.
We have over 200 subnets. I'm not the router admin, but I think updating all the relay agents could be quite a large task for us. It would be easier to build the DHCP servers and then turn off the old ones and assign the IP addresses of the old DHCP servers to our new Windows 2012 DHCP servers. Then we wouldn't have to update all of the relay agents. Is this possible? I saw in the documentation that building the servers requires registering their names/IP in AD, so I'm wondering if there might be a technical barrier to doing this. Also, I would like to have the new boxes built before the cutover instead of turning off the old ones and then bringing up the new ones without DHCP installed on their old IPs and building everything then.
If this can't be done, that's OK - we'll just have to do it the way you recommend by updating all of the relay agents. I was just hoping there might be a faster way for us.
You can build the new DHCP servers using some new IP addresses.
When you turn off the old DHCP servers, you can change the IP addresses of the new servers and assign the old IP addresses to them.
However, if you are deploying failover configuration, and your number of DHCP servers is increasing, then you will require additional IP addresses for your DHCP servers and will have to update your relay agents with these additional IP addresses.
In addition to what we said above -
Regarding your comment - "I saw in the documentation that building the servers requires registering their names/IP in AD, so I'm wondering if there might be a technical barrier to doing this."
You need to do this step (authorizing the DHCP server in AD) to get the DHCP server to start servicing clients. You can complete migration of the configuration/provisioning of the DHCP servers without this. Then, after you have changed the IP address of the DHCP server to the old IP address, you can authorize it in AD to get it start servicing clients.
I got a question on the timing of turning off the old DHCP and authorizing the new DHCP server.
My old server is running, I export the config and import it on the new not-yet-AD-authorized DHCP. Now I turn off the old one and then authorize the new one? Or do I first authorize the new one and then turn off the old one?
We got about 50 clients so it shouldn't really matter, but I'd like to avoid any mishappenings.