Eliminate the pain of installing an IP stack
If you have an IP-based network (if you don't yet, you will soon), you've probably discovered the painful part of putting an IP stack on everyone's PC. You have to type in arcane numbers like 18.104.22.168, provide the Windows Internet Name Service (WINS) and Domain Name System (DNS) server locations, identify the domain name, and perform other tedious tasks for each PC. Windows NT's Dynamic Host Configuration Protocol (DHCP) tool eliminates a lot of this runaround. (For details on DHCP, see John Enck, "Take A Number," Windows NT Magazine, October 1995.)
To use DHCP, you set up an NT server as a DHCP server and give it a range of IP addresses to assign. A PC with DHCP client software can then request an IP address from the DHCP server. The DHCP server hands out the next available IP address and can supply a subnet mask, WINS server, WINS node type (don't worry about what it is, just set it to "8"), domain name, DNS server, and default gateway.
Suppose you set up a subnet with 100 PCs. You have addresses 22.214.171.124 through 126.96.36.199 to give those PCs. You could go around and hardwire one IP address into each machine, but that's a lot of work. Instead, set up a DHCP server to distribute addresses and tell a machine that its subnet mask is 255.255.255.0, its WINS server is at 188.8.131.52, its WINS node type is 8, its domain name is acme.com, its DNS server is at 184.108.40.206, and its default gateway is 220.127.116.11.
Sound great? It is, in general. But be aware of a few wrinkles.
Setting up DHCP
To set up DHCP on an NT server, install the DHCP server in the usual place--Control Panel, Network, Add Software. You have to reboot the NT server to make it act as a DHCP server.
In the group Network Administration, you'll see a new program, DHCP Manager. It's the central DHCP control tool. Once you set up the DHCP server, you need to create a scope--a pool of IP addresses. In my example, the scope is 18.104.22.168 to 22.214.171.124.
To create a new scope, go to the DHCP Manager menu and select Scope and then Create. You can fill in the range of addresses, name the scope, and even exclude particular addresses. For example, in my network, which is 126.96.36.199, I can safely use DHCP to give out all IP addresses because most of my PCs run client software that supports DHCP. But I have a few fixed IP addresses: an Integrated Services Digital Network (ISDN) Mac-layer bridge takes addresses ending in .5 and .6, and some important servers take addresses ending in .50 through .53. These fixed addresses aren't a problem. I could, for example, put all addresses from 188.8.131.52 through 184.108.40.206 into a scope and exclude .5, .6, and .50 through .53.
Understanding Your Lease
When you create a new scope, you need to specify a lease time--how long an IP address is active. If you understand how a lease works, you'll understand some fundamentals about DHCP.
First, DHCP is a pull protocol--client-driven--rather than a push protocol--server-driven. The first time a DHCP client workstation comes up on a network, the client issues a broadcast seeking a DHCP server; this message is a "DHCP Discover." DHCP servers hear the workstation and respond by offering IP addresses; this message is a "DHCP Offer." The workstation looks through its offers and selects one (I'm not clear about how it selects. I've seen workstations turn down more-attractive leases in favor of less-attractive leases). The workstation broadcasts back to the DHCP server that it wants an offer; this message is the "DHCP Request."
Why is this third part of the DHCP sequence a broadcast rather than a directed communication to the DHCP server that offers the requested lease? The workstation sends a broadcast so all DHCP servers, including the requested DHCP server, hear the message; by broadcasting its message to the DHCP server, the workstation is saying to other DHCP servers, "Thanks for the offers, but I'm going with Server X."
Finally, the chosen DHCP server sends the lease information (the IP address, potentially a subnet mask, DNS server, WINS server, WINS node type, domain name, and default gateway) to the workstation in a message called the DHCP ACK (data communications jargon for acknowledge). You can remember the four parts of a DHCP message by the mnemonic DORA--Discover, Offer, Request, and ACK.
Now we have a workstation with an IP address and a lease period. For example, let's say the PC has address 220.127.116.11 for three days.
Set a Lease Duration
Because DHCP is a client-driven protocol, once the DHCP server gives an IP address and other information to a client, the server can't take it back until the lease expires. Suppose you change the domain name from acme.com to apex.com. The workstations don't receive this new information until they renew their leases. This limitation illustrates why I call this protocol a pull protocol rather than a push protocol--the DHCP server has no way to say to itself, "Well, I have this new domain name; let me contact 18.104.22.168 and make it change its domain name."
I encountered this problem when I set up my first DHCP server years ago. Thinking to make my life easier, I set the lease durations to "infinite." But, later, I needed to change my domain structure. I added some DNS servers and a default gateway address and divided my C network into four subnets. I had no problem rearranging DHCP to accommodate these changes. I changed the DHCP Manager and went to the Control Panel to stop the DHCP server and restart it. (Don't forget this step when you make changes to your DHCP servers.)
Soon I realized that none of my changes were in effect. The problem was that my workstations obtained IP addresses from DHCP with infinite leases, which told them, "You have this lease forever; you never have to check with me again." This situation seemed strange. I assumed that when a DHCP client boots, it checks with the DHCP server. After all, how else does the workstation know its IP address, subnet mask, and the like?
What I was missing was this: If your PC is a DHCP client, it keeps its lease information on its local hard disk. When the PC boots, it looks at the lease information. If that information says, "Use IP address such-and-such and subnet mask such-and-such, and you can use this until summer 2031," the workstation doesn't have to check with the DHCP server. And it doesn't.
I emailed my users, telling them to open up a command prompt window and type two commands: ipconfig /release and ipconfig/renew. Ipconfig/renew should be sufficient, but it isn't. I often see DHCP not working properly--it gets stuck on something and stops working. The two ipconfig commands usually straighten it out. For Windows 95, don't use ipconfig; rather, use winipcfg, which is a GUI version of ipconfig.
If the ipconfig or winipcfg commands don't work, go to each workstation, and erase the local DHCP information. On a DOS or Windows for Workgroups machine, the file is dhcp.bin. On a Win95 machine, the DHCP information is in the Registry in hkey_local_machine\system\currentcontrolset\services\vxd\dhcp\dhcpinfoxx, where xx is two digits. You can have multiple leases, and the two digits accommodate that capability. In NT, see hkey_local_machine\system\currentcontrolset\services\netcardname\parameters\tcpip. (Netcard name will be something like E159x.)
I get email from people who want me to send them my old columns. Thanks for the interest. You can contact Windows NT Magazine customer service at 800-793-5712 or 970-663-4700 for back issues. Read past columns on Windows NT Magazine's Web site at http://www.winntmag.com.