Migrating a DHCP Server

At present our DHCP server sits on our physical DC and file server. I’m going to be moving this a new Hyper-V machine and I didn’t want the hassle of writing down the details of each scope and then setting them back up on a new server. By using the built in “netsh” command it is possible to export and re-import the configuration, including settings and current leases, reservations etc.

Command line to export the DHCP settings

To export the configuration, open a command prompt on the current server and use the following:

netsh dhcp server \\{servername} export {filepath} all

so for me that looked like this:

netsh dhcp server \\gemini export c:\dhcpdb all

When the says “completed successfully”

 

Command to Import the Settings

Connect or login to your new server and then import the settings as follows:

netsh dhcp server \\{servername} import {filepath} all

I left the file where it was, however you could copy to anywhere that is convenient. for me the command looked like this:

netsh dhcp server \\svrv-dhcp-01 import \\gemini\c$\dhcpdb all

Once that has imported you’ll just need to unauthorize the old DHCP server and authorise the new. This is done by right clicking the server name and selecting authorise.

The next step will be to configure your vlan helpers on your switches should you have any.

My advice would be to do this during a time when as few people (ideally none) are using the network as possible. Alternatively the other option is to complete the export, import and authorisation as quickly as possible. This mitigates as much as possible that the two servers will not be handing out duplicate IP addresses. (if this is the case you’ll also need to update the IPhelpers on any of your switches should you use multiple vlans.

Let me know what you think...