Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  Advanced Search 


March 1999

DHCP Recovery


RSS
Subscribe to Windows IT Pro | See More Backup and Recovery Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

Proper preparations make a disaster manageable

I have a love-hate relationship with service packs. I love all their bug fixes, but I hate the quirky things they do. This month, I had to rebuild my home office's Domain Name System (DNS), Windows Internet Naming Service (WINS), and Dynamic Host Configuration Protocol (DHCP) server from scratch after Windows NT 4.0 Service Pack 4 (SP4) zapped it. (For information about SP4's fixes to these services, see "Service Pack 4," page 87.) But the experience was good practice, and it reminded me that I've never discussed NT disaster recovery the way I need to.

Upgrading My Network
When I moved into my current house, I wired the house to Category 5 specifications, knowing that one day I'd upgrade my home network from its snail's pace of 10Mbps to 100Mbps Ethernet. The price of 100Base-TX Ethernet boards has fallen rapidly for the past few years, and 10/100Mbps boards have been about the only networking card on the market for the past year. So by the time I moved to my current home, 40 percent of the devices on my network could already handle 100Mbps. For months, I had the necessary cables in place and many of the necessary Ethernet cards, but I didn't upgrade my network to 100Mbps because I couldn't justify paying the price of 100Mbps hubs. However, when I saw eight-port NETGEAR hubs for less than $250 at an Office Depot recently, I walked out the door with the three hubs the store had in stock. (Incidentally, I found the NETGEAR hubs shortly after I applied SP4 to my network's servers.)

Before you start writing to tell me that I could have found cheaper 100Mbps hubs elsewhere, let me say I already know that. I bought the NETGEAR hubs for three reasons. First, I've never purchased a bad piece of equipment from Bay Networks. That doesn't mean that Bay Networks doesn't make any bad boxes, but I haven't tripped over one yet. Second, the NETGEAR switches have many useful LEDs that tell you the connection's speed, network utilization rates, and other similar information. (Minasi's First Law of Datacom Equipment is, "The more lights, the better.") Third, the switches were right there. I was in the store buying other products, and the hubs were on the shelf; I didn't have to wait around for a delivery. (OK, I admit that I need instant gratification.)

Soon after I popped the new hubs into the network—which took me only 5 minutes—I noticed that my DNS, WINS, and DHCP server was communicating at only 10Mbps. (You immediately see the value of all those LEDs.) I scratched my head at the slow speed for about 10 minutes, wondering whether the network cabling was faulty. Eventually, however, the senility clouds parted, and I remembered that the reason the server runs only DNS, WINS, and DHCP is that it's old. The reason for the slow network speed was that the server contained only a 10Mbps card. I popped a standard 3Com XL 100Mbps card into the server, loaded the card's driver, rebooted the server, and—wham!—received a blue screen of death, a serious blue screen of death. NT refused to get past the blue kernel initialization screen, claiming that it couldn't find winserv.dll. Because I swap NICs among my servers all the time, because 3Com is a well-respected firm, and because the 3Com card is popular, I guessed that an SP4 fragility caused the server's failure.

Dealing with a DHCP Disaster
I decided that the fastest way to solve the server problem was to skip the attempted heroics ("If I reboot with ERD Commander and swap the SYSTEM hives around ...") and just reinstall NT on the server. If you've read this column for the past 12 months, you won't be surprised that I have an installation script that lets me run a batch file to automatically rebuild any of my servers' OSs and settings from scratch. The script takes less than half an hour to run. So I started the installation script, left it for half an hour, and returned to find a pristine NT server with DHCP, WINS, and DNS already installed.

The only trouble the new NT system caused me was that it required me to restore the DHCP, WINS, and DNS databases to their precrash states. I had run restoration drills in the past, so I was ready to restore DNS and WINS. But I hadn't found an easy way to restore the DHCP database.

Three different Microsoft articles describe how to rebuild a DHCP server. Unfortunately, the three articles suggest restoring the database in slightly different ways, and not any of the articles' methods have worked for me. However, after a bit of experimenting, I figured out how to put an old DHCP database on a new DHCP server.

Preparing for DHCP Recovery
You won't be able to restore a DHCP database if you don't have access to backups of four DHCP files. Three of the necessary backups hold your DHCP database.

NT 4.0 DHCP databases live in three files: dhcp.mdb, the main database; dhcp.pat, a smaller database that is similar to Access system.mdb files (DHCP uses an Access engine to store its data); and a transaction log, a file with a name such as J5xxxxxx.log (the x's represent numbers and letters that specify the log's sequence number). NT 3.51 DHCP databases live in these three files: dhcp.mdb, system.mdb, and jet.log. You can find these files in \Winnt\system32\dhcp OSs. (For more information about the DHCP database files, see Darren Mar-Elia, "WINS and DHCP Preventive Maintenance," page 61.)

DHCP automatically backs up its database hourly. When you're looking for backups to restore the DHCP database from, dig a bit deeper than the standard database directory to \Winnt\system32\dhcp\backup\jet\new. In that directory, you can find the system's most recent backups of dhcp.mdb, dhcp.pat or system.mdb, and the latest log file.

In addition to these three files, you need a file called dhcpcfg to restore a DHCP database. Your DHCP server stores information about the scopes and configuration options that you choose for DHCP in the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DHCPServer\Configuration Registry key. DHCP backs up that Registry key to dhcpcfg, which resides in the \Winnt\system32\dhcp\backup directory.

I use an AT command to copy my DHCP server's dhcp.mdb, dhcp.pat, dhcpcfg, and log files to another server twice a day. However, if you need to restore a server, you'll probably be able to access the files regardless of whether you copy them to a second machine. Even if you're facing a dead DHCP server, you might be able to get the files. If your system drive is FAT, try booting DOS to read the files; if your system drive is NTFS, try using a second NT system root or a program such as ERD Commander to read the files.

Restoring a DHCP Server
You have the four necessary backup files handy, and you're ready to rebuild your DHCP database. What do you need to do next?

First, get the DHCP Server service running on the new machine. If the machine has never been a DHCP server, installing the service is no sweat. Fire up Control Panel, and select Network, Services, Add, Microsoft DHCP Server.

However, you might run into a problem if your server has previously run DHCP Server. The first time you install DHCP Server, the installation process creates the \Winnt\system32\dhcp and \Winnt\system32\dhcp\backup directories. Even if you wipe DHCP Server off a system, root out the software's Registry entries, and reboot before reinstalling DHCP Server, NT apparently remembers (probably through a Registry key I can't find) that DHCP Server once existed on the system. The software's installation process doesn't re-create the \Winnt\system32\dhcp and \Winnt\system32\dhcp\backup directories. When you reboot after reinstalling the service, DHCP causes a Dr. Watson error in tcpsvcs.exe, and the DHCP Server service won't start. If you wipe out and reinstall DHCP Server, erase the files in \Winnt\system32\dhcp and \Winnt\system32\dhcp\backup but don't erase those two directories. Install the Microsoft DHCP Server service through Control Panel's Network applet, then without rebooting, apply the service pack you want to use. Reboot after you apply the service pack. When the server restarts, go to Control Panel's Services applet, locate Microsoft DHCP Server, and stop the service.

Next, restore your database. Copy the three \Winnt\system32\dhcp\backup\jet\new backup files—either dhcp.mdb, system.mdb, and jet.log or dhcp.mdb, dhcp.pat, and the log file—into \Winnt\system32\dhcp. This action will overwrite files that the DHCP installation creates; when NT provides a warning dialog box, confirm that you want the OS to copy over existing files.

After you copy the three database backup files, restore the DHCP configuration Registry key. Open regedt32 (regedit won't work for this restoration), navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\ Services\DHCPServer, and select the Configuration key. With the Configuration key highlighted, select Restore from the Registry drop-down menu. Regedt32 will prompt you for a filename; enter the path to your copy of dhcpcfg. When regedt32 asks whether you want to overwrite the existing Registry keys, click OK.

Start the DHCP Server service, and open DHCP Manager. You'll see that NT has restored your old scopes. Click Scope, Active Leases to display the leases that DHCP Manager knows about; the window will be empty. Click Reconcile, and you'll see a dialog box that shows all the leases that the old DHCP server knew about. Click OK, and DHCP will reintroduce those addresses into its database. When you finish this step, your DHCP server will be fully recovered.

If you want to make sure this procedure works on your network, try it out. Take the four backup files off a working DHCP server, and try restoring them on a test machine that isn't connected to your production network—you don't want a rogue DHCP server on your network. Don't trust anyone else's disaster recovery methods until you've tried the procedures.

End of Article



Reader Comments
Thanks for Mark Minasi’s Inside Out: “DHCP Recovery” (March). Instead of using the At command to copy the needed files to another server, what about using Windows NT’s replication tool? You could use the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DHCPServer\Parameters\BackupDatabasePath Registry key (type REG_EXPAND_SZ) to save the backup directory in the REPL directory and export it to one of your other servers (i.e., \%systemroot%\system32\repl\export\MyOtherServer).<br>
--Vince<br><br>

<i>A few readers suggested this approach. Good idea!<br>
--Mark Minasi</i>

Vince August 06, 1999


Please I need to see the script that you are using to restore your NT server.


Jide M. Owoeye May 12, 2000


Thank You Sir, saved my life. Didn't see that solution on Microsoft. Got my DHCP going perfectly

Neil O'Brien September 27, 2003


This solution worked very well except for the fact that Client Names and Comments in Client Properties of IP Reservations were not recovered on to the new DHCP server.

Thank you very much for your help.

Anonymous User February 22, 2005 (Article Rating: )


You must log on before posting a comment.

If you don't have a username & password, please register now.




Top Viewed ArticlesView all articles
The Memory-Optimization Hoax

Don't believe the hype. At best, RAM optimizers have no effect. At worst, they seriously degrade performance. ...

Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

SET Options and Recompilation

Learn how to tweak your server's SET options so that you don't have to constantly recompile. ...


Related Articles DNS Disaster Recovery

Storage Whitepapers Combining Deduplication and VMware Disaster Recovery: Cascading Savings Improves Cost Effectiveness

Virtualizing Microsoft Exchange Server 2007

StoreVault SnapManagers for Microsoft Exchange and SQL Server

Related Events Virtualization Management

Virtualization 101

Check out our list of Free Email Newsletters!

Storage eBooks A Guide to Windows Certification and Public Keys

SQL Server Administration for Oracle DBAs

Keeping Your Business Safe from Attack: Encryption and Certificate Services

Related Storage Resources Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro Windows Dev Pro IT Job Hound ITTV
IT Library Technology Resource Directory Connected Home Windows Excavator Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2008 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing