Migrating DHCP services to 2012 R2 and configuring scope failover


A time may come when you need to migrate your existing DHCP services to new servers/hardware.  Windows Server 2012 ships with powershell cmdlets to make this a simple transition.

You can read about the process here:  http://blogs.technet.com/b/teamdhcp/archive/2012/09/11/migrating-existing-dhcp-server-deployment-to-windows-server-2012-dhcp-failover.aspx

I have two DHCP servers (Windows Server 2012) in a failover configuration, leveraging the new capabilities in failover DHCP for Server 2012, which you can read about here:  http://technet.microsoft.com/en-us/library/jj200226.aspx.  I will be migrating these to Windows Server 2012 R2 DHCP servers.

I start by installing the DHCP server role on my new 2012 R2 DHCP servers.  Then, a quick configure using the Post install wizard from server manager to authorize the DHCP servers in AD.

Next up – I need to export the DHCP server configuration in powershell, from the old server.  In this case, I will be migrating from two DCHP servers (DC1,DC2) and migrating them to the new ones (DC01,DC02). 

Create a folder on the new DHCP primary server (DC01) for C:\export.  Open an administrator powershell session.  Run the following command to export remotely from the old DCHP primary server:

Export-DhcpServer –ComputerName DC1.opsmgr.net -Leases -File C:\export\dhcpexp.xml –verbose

Next up, we need to create a backup path for the DHCP server database on the new DHCP server, DC01.  Create a folder C:\dhcp\backup.  Then, we can import the old DHCP server configuration using the following command:

Import-DhcpServer –ComputerName DC01.opsmgr.net -Leases –File C:\export\dhcpexp.xml -BackupPath C:\dhcp\backup\ -Verbose

The last import we need to run, is to import the server configuration ONLY to the secondary, or failover DHCP server.  First, on DC02 (the new failover DHCP server) create a backup folder at C:\dhcp\backup.  Then, go back to DC01 where you have the local export files, and run the following command to import server config to DC02:

Import-DhcpServer –ComputerName DC02.opsmgr.net –File C:\export\dhcpexp.xml –ServerConfigOnly –verbose –BackupPath C:\dhcp\backup\

At this point, we have imported the server configuration to BOTH new DHCP servers, and we have imported all the lease and scope to the new primary DCHP server.  What we need to do in order to complete the configuration, is to set up the failover configuration on the new pair.  This is covered here:  http://technet.microsoft.com/en-us/library/hh831385.aspx#failover_1

On DC01, open the DHCP control applet, and right click IPv4 (all scopes) or specific scopes, and click “Configure Failover”

image

Step through the wizard, and choose “Load balance" mode.

image

Provide a shared secret for the DCHP servers to authenticate with each other for replication.

You will now see the failover configuration data for each scope:

image

Open the DHCP applet on the secondary failover DHCP server, and you should see the replicated scope and lease information:

image

You can de-activate the scopes on the old DHCP server.  After testing and functional approval, you can remove DHCP services from the legacy DHCP server computers.


Comments (7)

  1. Anonymous says:

    Hi Kevin
    im migrating DHCP from w2003 to w2012r2 with failover
    using a mix of netsh export, and powershell to migrate the active leases
    my plan is to activate the lease on the new box, and then de-activate the scope
    on the old w2003 box, till i finish with all the scopes migrations
    i read on 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 im migrating ? meaning the scope x is disabled on w2003
    while same scope x is enabled on new w2012r2 server ?

    Thanks
    Martin

  2. Thamola says:

    Nice write up, it was helpful.

  3. Kevin Holman says:

    Martin - I don't have enough experience with DHCP migrations to answer that. I'd recommend finding a TechNet forum for that.

  4. Ed (DareDevil57) says:

    thanks for sharing. great article

  5. Adedamola Ibironke says:

    I just did migration from 2008 r2 to server 2012 r2. The old scope should be active while exporting configuration, it can be deactivated after the export.

  6. Allan says:

    Great work...thanks

  7. mike says:

    I advise not to deactivate Win2003 scopes as there is flaw within Windows 2003 DHCP Server service.

    See http://support2.microsoft.com/kb/944200.
    Install hotfix prior to migration. Then you can use netsh to migrate scopes.

Skip to main content