Recipe14.16.Importing and Exporting DHCP Server Configuration


Recipe 14.16. Importing and Exporting DHCP Server Configuration

Problem

You want to export the DHCP Server configuration and use it on another server.

Solution

Using a graphical user interface

The Windows 2000 Resource Kit contains a tool called dhcpexim , which is a simple GUI for exporting and importing DHCP Server configuration. However, I've tested it on Windows Server 2003 and have not been able to make it work properly. Based on other newsgroup postings on the subject, it doesn't appear the Windows 2000 version of dhcpexim works with Windows Server 2003. So until a new version is released (which may never happen), your only option on Windows Server 2003 is the CLI solution described next.

Using a command-line interface

The following command exports DHCP Server configuration to c:\dhcp.txt:

>  netsh dhcp server export C:\dhcp.txt all

To import this configuration on another server, copy c:\dhcp.txt to the target server and run the following command on that server (I'm assuming the DHCP Server has already been installed):

>  netsh dhcp server import C:\dhcp.txt all

Using VBScript

See Recipe 14.0 for more information on how to run the netsh command from within a script.

Discussion

The netsh tool makes it easy to import and export DHCP Server configuration information. In the CLI solution, I showed how to export all scope information, but you can specify a subset if you want only certain ones. The following command exports only the scopes pertaining to 10.1.2.0 and 10.1.3.0:

>  netsh dhcp server export C:\dhcp.txt 10.1.2.0 10.1.3.0

According to the usage information for export and import commands, the DHCP Server service will not respond to clients while these commands are being run. Keep this in mind if you have many scopes to export; it can take several minutes and clients may not be able to acquire a lease during this time.


See Also

MS KB 130642 (How to Move a DHCP Database to Another Windows Server)



Windows Server Cookbook
Windows Server Cookbook for Windows Server 2003 and Windows 2000
ISBN: 0596006330
EAN: 2147483647
Year: 2006
Pages: 380
Authors: Robbie Allen

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net