Flylib.com

Books Software

 
 
 

Recipe14.13.Modifying the DHCP Database and Audit Log Paths


Recipe 14.13. Modifying the DHCP Database and Audit Log Paths

Problem

You want to move the DHCP database or audit logs from the default location ( %SystemRoot%\system32\dhcp ) to another directory or filesystem.

Solution

Using a graphical user interface

  1. Open the DHCP snap-in.

  2. In the left pane, right-click on DHCP and select Add Server .

  3. Type in the name of the DHCP Server you want to target and click OK .

  4. Right-click the server node and select Properties .

  5. Click the Advanced tab.

  6. Modify the audit file or database path as needed and click OK .

Using a command-line interface

The following command sets the database path to d:\dhcp :

> netsh dhcp server set databasepath d:\dhcp

The following command sets the audit log file path to d:\dhcp\logs :

> netsh dhcp server set auditlog d:\dhcp\logs

Using VBScript

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

Discussion

Based on your disk configuration, the default location for the DHCP Server database and audit logs may not be sufficient. In any case, you are better off moving these paths off of the system drive, especially if you have multiple disks on the server. In a high-load scenario, disk access to the DHCP database can have an impact on DHCP response times. If you can move the database and logs to a separate disk, the DHCP Server won't compete with the operating system to access the filesystem.

By default, the DHCP database is named dhcp.mdb . You can change this too if necessary, although not by using the DHCP snap-in. Use the following command to change the name of the database to rallencorp-dhcp.mdb :

> netsh dhcp server set databasename rallencorp-dhcp.mdb

After modifying the database or audit log paths or the database name, you have to restart the DHCP Server service for the changes to take effect.


See Also

Recipe 14.12


Recipe 14.14. Backing Up the DHCP Database

Problem

You want to back up the DHCP database.

Solution

Using a graphical user interface

  1. Open the DHCP snap-in on the target DHCP Server.

  2. In the left pane, click the server node.

  3. From the menu, select Action Backup .

  4. Select the folder to store the backup files in and click OK .

Using a command-line interface

You can't initiate a backup from netsh , but you can configure how frequently the automatic backups occur and where backup files are stored. The following command changes the default backup time to 24 hours (1,440 minutes):

> netsh dhcp server set databasebackupinterval 1440

The following command changes the backup location to d:\dhcp\backups :

> netsh dhcp server set databasebackuppath d:\dhcp\backups

You can also dump the DHCP Server configuration to a text file and import it later using netsh . Here is how you export it:

> netsh dhcp server dump > dhcpconfig.dmp

The dump option does not export any lease information.


Using VBScript

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

Discussion

The DHCP Server service automatically performs a backup of the DHCP database and DHCP Server registry configuration key every 60 minutes (and overwrites the previous back up). You can also perform a manual backup as outlined in the GUI solution. Backup files are stored in %SystemRoot%\system32\dhcp\backup by default, but you can change that location as described in the CLI solution. You should change this path to another drive so that a disk failure doesn't impact both the active database and the backup files.

The DHCP Server takes care of performing regular database backups, but you'll still need to use a backup tool such as NTBackup to archive those backups on a regular basis. As long as you are backing up the %SystemRoot%\system32\dhcp directory and the system state (which includes the registry), you can restore the database and server configuration on the same server or on another server if necessary.

See Also

Recipe 14.15, Recipe 14.16, MS KB 173396 (How to Restore a Corrupted DHCP Database File), and MS KB 325473 (How to move a DHCP database to a computer that is running Windows Server 2003)