Implementing a DHCP Server
|Archived content. No warranty is made as to technical accuracy. Content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.|
Do you run TCP/IP on your network? If so, you should be using Dynamic Host Connection Protocol (DHCP) to assign IP addresses to your network clients. Using a DHCP server eliminates many common configuration problems. It's also a good idea to install a DHCP server if you're planning on upgrading to Microsoft Windows 2000. In this article, we'll discuss the importance of using a DHCP server. We'll also show you how to install and properly configure DHCP.
On This Page
What Is DHCP?
DHCP stands for Dynamic Host Configuration Protocol. DHCP is an extension of the BOOTP protocol that allows diskless workstations to connect to a network and automatically obtain an IP address. DHCP is capable of supplying each network client with an IP address, subnet mask, default gateway, an IP address for a WINS server, and an IP address for a DNS server.
Why Use DHCP?
Okay, so DHCP can automatically configure your clients for TCP/IP, but you may be wondering why you should bother making the switch if you're already set up to use static IP addresses.
Before we address that issue, we should point out that regardless of whether you use DHCP, some IP addresses must always remain static. For example, you must use a static IP address on computers running DHCP, WINS, and DNS. It's also a good idea to use a static IP address for your primary domain controller.
Keeping in mind those exceptions, you should use dynamic IP addresses for all other computers. The advantage of using dynamic IP addresses is that you avoid many common problems. For example, if you manually configure IP addresses, you must keep track of which addresses you have and haven't assigned, and to whom. If you accidentally assign two people the same address, of if a user monkeys around with his or her address, you can run into network problems that can be very hard to resolve.
Furthermore, in many organizations, it's common practice to constantly move computers all over the building or between buildings. In such situations, if you were using static IP addresses, you'd be forced to change IP addresses to an address that falls within the new subnet every time you move a PC. However, if you're using DHCP, the computer will automatically contact a DHCP server and receive an IP address that fits the new subnet.
Finally, DHCP is handy in situations where you're running low on IP addresses. With statically assigned IP addresses, you must provide each computer with a unique IP address. The computers retain these addresses whether or not they are turned on.
However, chances are good that not all computers will be in use all the time. In such situations, DHCP can assign IP addresses on an as-needed basis. This frees you from having to ensure that you have enough IP addresses for every PC. Instead, you need only enough IP addresses for the PCs that are turned on at any given moment.
DHCP and Microsoft Windows 2000
As you may be aware, Microsoft Windows 2000 will depend heavily on a new service called dynamic DNS. Dynamic DNS will resolve domain names to IP addresses just as Microsoft Windows NT's current DNS service does. What makes dynamic DNS different is that it also resolves NetBIOS names to IP addresses in a similar fashion to Microsoft Windows NT's WINS service.
The reason that the service is called Dynamic DNS is that every time a computer comes on line or drops off line its tables are updated. As you might have guessed, such functionality is only possible when using a DHCP server.
When a new computer comes on line, DHCP assigns it an IP address. DHCP then contacts the dynamic DNS server and tells it the computer's NetBIOS name and IP address. The Dynamic DNS server then makes this information available to any computer requesting it.
How Does DHCP Work?
We mentioned earlier that DHCP was an extension of the BOOTP protocol used by diskless workstations, but you still may not have a clear idea of exactly how a DHCP server does its job.
DHCP is a broadcast-based protocol. As with other types of broadcast traffic, it won't cross a router unless specifically configured to do so. If you need such capability, you must configure your routers to pass DHCP traffic that occurs across UPD ports 67 and 68.
DHCP operations fall into four basic phases. These phases are IP lease request, IP lease offer, IP lease selection, and IP lease acknowledgement.
IP Lease Request
Whenever a computer comes on line, it checks to see if it currently has an IP address leased. If it doesn't, it requests a lease from a DHCP server. Because the client computer doesn't know the address of a DHCP server, it uses 0.0.0.0 as its own IP address and 255.255.255.255 as the destination address. Doing so allows the client to broadcast a DHCPDISCOVER message across the network. Such a message consists of the client computer's Media Access Control (MAC) address (the hardware address built into the network card) and its NetBIOS name.
IP Lease Offer
When a DHCP server receives an IP lease request from a client, it extends an IP lease offer. This is done by reserving an IP address for the client and broadcasting a DHCPOFFER message across the network. This message contains the client's MAC address, followed by the IP address that the server is offering, the subnet mask, the lease duration, and the IP address of the DHCP server making the offer.
IP Lease Selection
When the client PC receives an IP lease offer, it must tell all the other DHCP servers that it has accepted an offer. To do this, the client broadcasts a DHCPREQUEST message containing the IP address of the server that made the offer. When the other DHCP servers receive this message, they withdraw any offers that they might have made to the client. They then return the address that they had reserved for the client back to the pool of valid addresses that they can offer to another computer. Any number of DHCP servers can respond to an IP lease request, but the client can only accept one offer per network interface card.
IP Lease Acknowledgement
When the DHCP server receives the DHCPREQUEST message from the client, it initiates the final phase of the configuration process. This acknowledgement phase involves sending a DHCPACK packet to the client. This packet includes the lease duration and any other configuration information that the client might have requested. At this point, the TCP/IP configuration process is complete.
Now that you know how DHCP works, let's discuss the procedure for configuring a DHCP server. Begin by selecting a Microsoft Windows NT Server within your organization. This server must continue to use a static IP address after DHCP is installed.
When you've selected your server, open Control Panel and double-click on the Network icon. When you see the Network properties sheet, select the Services tab. Next, click the Add button to access the Select Network Services dialog box. At this point, select Microsoft DHCP Server from the Network Services list and click OK. When you do, you'll be prompted for the location of your Microsoft Windows NT CD-ROM. Enter the path to the Microsoft Windows NT Installation files and click Continue.
When Microsoft Windows NT finishes copying the necessary files, you'll see a warning message indicating that if any network adapters within the server are using dynamic IP addresses, you must change them to static addresses. Click OK to clear the warning. Now, click the Close button to close the Network properties sheet. Microsoft Windows NT will now update the bindings and ask you to restart your computer.
Before you begin configuring your newly installed DHCP service, there are a few things that you need to know. DHCP will ask you to provide at least one scope. A scope is a range of IP addresses that the server is allowed to assign to clients.
As simple as this may sound, there are several things that you must watch out for. First, you must remember that DHCP servers don't exchange information with each other. Therefore, it's important to make sure that no two DHCP servers' scopes overlap.
Second, you have to remember that there are servers within your organization that must maintain a static IP address. For example, DHCP, DNS, and WINS servers must all use static IP addresses. Therefore, you should leave some of your assigned IP addresses outside the scope. For example, suppose that you own the IP address range of 18.104.22.168 to 22.214.171.124. You might consider making the DHCP scope contain only the addresses from 126.96.36.199 to 188.8.131.52, thus reserving ten IP addresses for servers requiring a static IP address.
Finally, you must take into account the number of subnets on your network. A single DHCP server can service multiple subnets, but only if your routers are configured as DHCP relay agents. You should also keep in mind that DHCP can only assign one scope to each subnet.
When you've planned your DHCP configuration, select DHCP Manager from the Administrative Tools menu. When the DHCP Manager program starts, select the Local Machine entry in the DHCP Servers column, as shown in Figure A.
Now, select Create from the DHCP Manager's Scope menu. When you do, you'll see the Create Scope dialog box. Begin by filling in the Start and End Address. These are the addresses that mark the beginning and end of your scope. Next, enter the Subnet Mask of the addresses in your scope.
If necessary, you can also set a Start and End Address for an Exclusion Range. This is a range of addresses that won't be assigned to DHCP clients. DHCP will reserve these addresses for servers requiring static addresses. It's possible to use multiple exclusion ranges.
You can also set the lease duration. If you have plenty of addresses to go around, simply set the lease to unlimited. Otherwise, set the lease duration to whatever time period you see fit.
Finally, you can assign a name to the scope and add a comment to help identify the purpose of the scope. When you've finished, the Create Scope dialog box will look something like the one shown in Figure B.
At this point, click OK to create the scope. When you do, you'll see a message stating that the scope has been created but not activated. The message then gives you the opportunity to activate the scope. Normally, you'd want to go ahead and activate the scope, unless some of the clients needed to be reconfigured first. If you need to change the scope's status later on, you can do so via the Scope menu's Activate and Deactivate commands. At this point, you'll be able to expand the Local Machine entry to see the scope beneath it. The light bulb, shown in Figure C, indicates that the scope is active.
Now that you've got the basics, it's time to look at some of the more advanced configuration options. Advanced configuration options may be applied on a global, scope, or individual client basis. To set the advanced options, select the desired coverage level from the DHCP Options menu. For example, if you want to set options for an entire scope, you select the Scope command. When you do, you'll see the DHCP Options dialog box, shown in Figure D.
Notice in Figure D that there's a long list of advanced options in the Unused Options window. Although this list may seem overwhelming at first, keep in mind that only a few of these options can be set for Microsoft clients. These options include the following:
Router: Specifies the address of a router. This is the equivalent of a default gateway.
DNS Server: The address of a DNS server on your network.
WINS/NBT node type: Specifies the type of NetBIOS name resolution used over the TCP/IP network. Valid options are:
WINS/NBNS Servers: The address of a WINS or a NetBIOS name server.
NetBIOS Scope ID: Computers running NetBIOS over TCP/IP can only exchange NetBIOS information with other computers using the same NetBIOS scope ID.
To set any of these options, select the option from the Unused Options window and click Add. The option will then move to the Active Options window. You can then select the option and click the Value button to view the current values for the option. To edit or add new values, click Edit Array.
In this article, we've discussed how installing a DHCP server can help eliminate many network problems. We then went on to explain Microsoft Windows 2000's dependency on DHCP. Finally, we showed you how to install and configure a DHCP server.
Brien M. Posey is an MCSE and a freelance technical writer. He also works as a network engineer for the Department of Defense. You can contact him via e-mail at Brien_Posey@xpressions.com. (Because of the large volume of e-mail that he receives, it's impossible for him to respond to every message. However, he does read them all.)
We at Microsoft Corporation hope that the information in this work is valuable to you. Your use of the information contained in this work, however, is at your sole risk. All information in this work is provided "as -is", without any warranty, whether express or implied, of its accuracy, completeness, fitness for a particular purpose, title or non-infringement, and none of the third-party products or information mentioned in the work are authored, recommended, supported or guaranteed by Microsoft Corporation. Microsoft Corporation shall not be liable for any damages you may sustain by using this information, whether direct, indirect, special, incidental or consequential, even if it has been advised of the possibility of such damages.