Microsoft Windows DHCP Team Blog

The world's most deployed DHCP Server! Deploy and discuss about your fav. server, here!

Migrating existing DHCP Server deployment to Windows Server 2012 DHCP Failover

Migrating existing DHCP Server deployment to Windows Server 2012 DHCP Failover

  • Comments 43
  • Likes

Introduction

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-

  1. Install DHCP Server role on 2 Windows Server 2012 computers.
  2. Export DHCP server configuration from existing server.
  3. Import all DHCP server configuration on the Windows Server 2012 DHCP server intended to be the primary server in the failover relationship.
  4. Import only server-level configuration on the Windows Server 2012 DHCP server intended to be the failover partner server.
  5. Configure DHCP failover from the intended primary server.
  6. Update DHCP relay agents with IP addresses of the DHCP failover servers

Export DHCP server configuration and leases

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.

Import DHCP server configuration and leases on Windows Server 2012

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:

  • Vendor or User classes other than those which are built-in.
  • Option definitions other than those which are built-in
  • Server level option values
  • MAC address based filters
  • Conflict detection attempt (if set to something other than the default)

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.

Updating other DHCP related configuration

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.

Conclusion

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.

Other Links

Team DHCP

Comments
  • Hi Hans,

    You should definitely avoid having both DHCP servers authorized and servicing clients at the same time since that could lead to duplicate IP address situation leading to bad addresses on the DHCP server. You can do the following sequence of steps -

    Remove the binding of the new DHCP server. This will ensure that clients are not serviced by this DHCP server. Even when the binding is removed, you can perform import/export on this DHCP server.

    Authorize the new DHCP server

    Remove authorization for the old DHCP server

    Enable the binding of the new DHCP server. Now the new DHCP server will start servicing the clients.

    Thanks.

  • The other thing I found is needed to release the existing IP, what would the best route to do without released/renew/reboot the machine? Should I just wait until the lease is over? no problem migrating the IP/Leases

    Thank,

    JR

  • Hi JR,

    I am unable to understand the question very clearly. If you are saying, all the currently leased IP addresses need to be released/expired before performing the migration, it is definitely not required since the steps mentioned above will migrate active leases from the source server to destination server. Let us know if this did not answer your question.

  • May want to consider enabling "conflict detection attempts" when migrating from one dhcp server to another.  DHCPSERVERNAME -> ipv4 <- right click  properties -> select advanced, put in 1 or 2.  Should be done on all dhcp servers that need it enabled.  This will make sure the IP being assigned is not in use.  

    Thanks MSFT for the LB/FO feature.  

  • Help!!

    I'm following the steps listed to import DHCP from 2K8R2 to WK12, but the import is failing on importing the active leases.

    The server config and the reservations are all pulled in OK on to the new server however, importing the active leases is failing.

    Each attempt to import an active lease fails with:

    Import-DhcpServer : Failed to add IP address lease for 10.3.37.230 on server newdhcpserver.mycompany.localnet. :

    There are no more endpoints available from the endpoint mapper. (1753)

       + CategoryInfo          : NotSpecified: (10.3.37.254:root/Microsoft/...cpServerv4Lease) [Import-DhcpServer], CimEx

      ception

       + FullyQualifiedErrorId : WIN32 1753,Import-DhcpServer

    can anyone assist with this???

    Thanks

  • is not recognized as the name of a cmdlet....

  • Well, could you please mention what cmdlet are you referring to. All the cmdlets referred in the blog are part of Windows Server 2012. If you are using on Windows 8 client, you will need to install RSAT (Remote Server Administration Kit)

  • Dear Team DHCP Thank you very much for such valued article, However I have a quick question..

    When I'm done Export and Importing the backup of old dhcp server and ready  to Authorize the new DHCP server , do I have to authorize the fail-over (secondary) dhcp server as well ?

    Thanks !!!

  • CITS, Glad to know that you found the article useful.

    Yes - you need to authorize both the DHCP failover servers individually.

    Another things you need to do is configure the DHCP relays/IP helpers to forward DHCP packets to both the DHCP failover servers.

  • Gr8, I'm planning to do the migration this weekend, thanks a lot for your quick reply.

  • Hi Guys. in regards to the migration of leases question...here is mine i am planning to move the scopes from 2003 to 2012r2, so will run netsh to export the entire of the scopes, with the leases, and import them into the new one, but i am planning to play it safe and de-activate scopes in the old one and activate the scopes on the new 2012r2 as im moving along, the problem is since im actually doing the netsh once, the leases will be old on the 2012r2 once this is moving...im guessing i should just be deleting the leases from the 2012r2 box ? and get the clients just request a new IP ? or keep the leases info from the netsh export, and let DHCP work its magic ? Thanks guys Martin

  • Its recommended that you migrate and retain the leases on the new server. The new server will automatically delete the leases if they expiry. You need not delete them. Migrating and retaining leases will avoid the problem of duplicate IPs on the network.

  • Thanks for the reply, I checked the DHCP documentation that the scopes should not be de-activated unless they are being deleted for good so my question is...can they co-exist while i am migrating ? meaning the scope x is disabled on w2003 while same scope x is enabled on new w2012r2 server ? Thanks Martin

  • Hi Martin, Yes. Deactivates as well as active scopes can be migrated together. I noticed that you mentioned migration from WS 2003. The PowerShell cmdlets including Export mentioned in this blog is supported for WS 2008 onwards. For migrating from WS 2003, you can use netsh export/import or Windows Server Migration tool.

  • Hi team. Thank you for this great feature and article. I have a question: If I have a subnet stretched to two datacenters and planning to put one DHCP loadbalance node in each of the datacenters, what will happen if line between datacenters goes down, but both DHCP server keep running? I think the failover cluster will go in communication interrupted, but clients can still reach both servers, but both servers will respond to all clients, correct?

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment