How to backup and restore DHCP server in Windows server 2008

On a disaster recovery process you don’t need to manually restore DHCP server details as your System state recovery will recover DHCP server details as well. DHCP servers store DHCP lease and reservation information in database files(MDB file - Microsoft Access Database file). By default, these files are stored in the directory %SystemRoot%\System32\DHCP and this database is backed up every 60 minutes automatically. The DHCP folder may contain below entries,

  • Dhcp.mdb: The primary database file for the DHCP server
  • J50.log: A transaction log file used to recover incomplete transactions in case of a server malfunction
  • J50.chk: A checkpoint file used in truncating the transaction log for the DHCP server
  • Res1.log: A reserved log file for the DHCP server
  • Res2.log: A reserved log file for the DHCP server
  • Tmp.edb: A temporary working file for the DHCP server

Note: Res1.log and Res2.log will be available only if you have any IP addresses reserved.
  

However if you would like to create a manual backup of your DHCP server you can perform this within few steps.

Things to notify before backup

  • To perform this procedure you must be a member of the Administrators group or the DHCP Administrators group on the DHCP server.
  • You must choose a local drive for the DHCP database backup folder.
  • The default backup location for the database backup is %systemroot%\System32\Dhcp\Backup.
  • It is recommended that you back up your DHCP database to a location other than the local drive using Windows Backup (ntbackup.exe) or non-Microsoft backup software.
  • When you store a manually created backup of the DHCP database in the same location as the synchronous backup that the DHCP server creates every 60 minutes, the manual backup is overwritten when automatic backup occurs.

Creating the DHCP backup

1. In the DHCP console, right-click the server you want to back up, and then click Backup. Else select the server that you want to backup and select the tab Actions->Backup
2. In the Browse For Folder dialog box, select the folder that will contain the backup DHCP database, and then click OK.
3.Verify the backup is completed by manually opening the backup location.

Things to notify before restore

  • To perform this procedure you must be a member of the Administrators group or the DHCP Administrators group on the DHCP server.
  • Only a DHCP database backed up from the same Windows Server version can be restored. Restoring a DHCP database from a different Windows server version is not supported. To migrate a DHCP database from one Windows Server version to another, use the netsh export/import command.
  • Only DHCP databases from the same language version can be restored. For example, a DHCP database from DHCP server running an English language version of the operating system cannot be restored to a DHCP server running a Chineselanguage version of the operating system.
  • To restore the DHCP database, the DHCP service is temporarily stopped. When it is stopped, DHCP clients are unable to contact the DHCP server and obtain IP addresses. 

Restoring the DHCP server from backup

1. In case of disaster recovery you may need to get the copy of the DHCP server backup from System state backup.   In this case get a good copy of the %SystemRoot%\System32\DHCP\Backup directory from the system state backup. If you have a DHCP server backup on another server or disk copy this to servers local disk and proceed as below.
2. Start the DHCP console, right-click the server you want to restore, and then click Restore.
3. In the Browse For Folder dialog box-> select the folder that contains the backup you want to restore and then      click OK.
4.As notified above it will ask to stop the DHCP service temporarily, click Yes to continue.



5.You will have the below screens when these actions takes place.




6.Once it is restored you will have the success message.


7.If there is an issue while restoring you will have the below window and to troubleshoot review your system logs.


Additional information

Manually backup and restoration of DHCP server can be done using command line as well. Netsh will help you to do it. Follow these steps if you would like to;

Backup using command prompt

1.Open command prompt as Administrator(Right click and select Run as administrator(You must a member of administrator or DHCP administrators to perform this)).
2.Type 'netsh' ENTER-> Now in order to connect to DHCP service type 'dhcp' ENTER.
3.Now specify the DHCP server, you need to type 'server  <\\dhcp server name>' ENTER(In my network server name is 'server-1')
4.You are now connected with the DHCP server and in order to perform a backup type 'backup <directory to save the backup>' ENTER(For me it is 'backup c:\dhcp'). Once it is completed you will have a success message.


The above backup operation can be done in a single step as well. In command prompt type,
Netsh dhcp server <\\yourDHCPservername> backup <directory to save the backup> ENTER.
For me it will be : 
netsh dhcp server \\server-1 backup c:\dhcp


Restore using command prompt

1.Open command prompt as Administrator(Right click and select Run as administrator(You must a member of administrator or DHCP administrators to perform this)).
2.Type 'netsh' ENTER-> Now in order to connect to DHCP service type 'dhcp' ENTER.
3.Now specify the DHCP server, you need to type 'server  \\dhcp server name' ENTER(In my network server name is 'server-1')
4.You are now connected with the DHCP server and in order to restore type 'restore  <directory where the DHCP backup is available>' ENTER(I have saved my backup in 'c:\dhcp'). Once it is completed you will have a success message.


In order to restore DHCP in a single step type the below command:
netsh dhcp server <\\YourDHCPserver> restore <backup location>ENTER
For me it will be:
netsh dhcp server \\server-1 restore c:\dhcp



If you would like to know more about the operations that can be performed with netsh, type 'help' or '?' which will list out all the available commands.

2 comments: