DHCP allows you to dynamically assign IP address to your network computers and other devices. IP addresses are taken from a pool of addresses and assigned to computers either permanently or for a fixed lease time. When you consider that you must configure every client computer on an IP network with such things as an IP address, a subnet mask, a default gateway address, and a DNS server address, you can see that there is an incredible margin for error.
DHCP provides a dynamic environment for assigning IP addresses to computers and devices on the network. It actually simplifies much of the drudgery that would be involved in manual assignments of IP addresses. Most network operating systems including Novell NetWare and Microsoft Windows Server 2003 provide the DHCP service, which can be configured on a network server that provides other services or on a standalone network server (which provides only the DHCP service). We will look at configuring a server for DHCP in a moment. First, let's discuss how DHCP clients request an IP address from a DHCP server.
DHCP Client Address Requests
Before a computer can request an IP address and other IP- related information from a DHCP server, it must be configured as a DHCP client. Most client operating systems are actually configured as DHCP clients by default. For example, Windows XP Professional is configured to obtain its IP address and the address of the DNS server automatically, as shown in Figure 12.3.
Figure 12.3. A computer must be configured as a DHCP client.
Once a network client is configured as a DHCP client, it is ready to obtain IP settings from the DHCP server. When a DHCP client boots up for the first time, it goes looking for an IP address. The client initializes TCP/IP (a stripped-down version) and broadcasts a DHCPDISCOVER message, which is a request for an IP lease that is sent to all DHCP servers (addressed to 255.255.255.255, meaning all nodes on the network). This broadcast message contains the host name of the client (which in most cases is also the client's NetBIOS name ) and the MAC hardware address of the client.
In the next step, a DHCP server (or servers, if more than one is available) on the subnet will respond with a DHCPOFFER message that includes an offered IP address, an accompanying subnet mask, and the length of the lease. The message also contains the IP address of the DHCP server, identifying the server. The DHCPOFFER message is also in the form of a broadcast, because at this point the client does not have an IP address.
When the client receives the first DHCPOFFER message (it may receive multiple offers, but it will go with first appropriate offer that it receives), it will then broadcast a DHCPREQUEST message to all DHCP servers on the network, showing that it is accepting an offer. This broadcast message will contain the IP address of the DHCP server whose offer the client accepted. Knowing which DHCP server was selected allows the other DHCP servers on the network to retract their offers and save their IP addresses for the next requesting client (yes, it does sound a little bit like a used car lot).
Finally, the DHCP server that supplied the accepted offer broadcasts an acknowledgement message to the client, a DHCPACK message. This message contains a valid IP address lease and other TCP/IP configuration information. Windows DHCP clients store the information received from the DHCP server in its Windows registry.
IP addressing and other information received from the DHCP server is considered a lease. This implies that the lease will expire at some point. You can actually configure the length of IP address leases on a DHCP server. On a Windows network, the DHCP client will actually begin to broadcast a request message when half the lease time has expired .
If your network is fairly static as far as the movement of devices and bandwidth is an issue, longer leases lessen the number of DHCP broadcasts because computers do not have to renew their IP leases all that frequently. Fewer broadcasts mean less bandwidth is soaked up by the broadcast traffic.
Configuring a DHCP Server
Most network operating systems supply the DHCP service as either a part of the operating system software or as an add-on to the network operating system. Both Windows Server 2003 and Novell NetWare 6x provide DHCP as part of the NOS software. You can either install the DHCP service on these network operating systems when you first install the server software or you can add the DHCP service to the server's configuration after the server is up and running. For example, Windows Server 2003 uses the Configure Your Server Wizard to add a service such as DHCP (the NetWare and Linux environments also have utilities for adding services to a server's configuration) as shown in Figure 12.4. Selecting the DHCP Server role and then clicking Next installs the service on the Windows server.
Figure 12.4. The DHCP service can be added to a server's configuration.
Once you have installed the DHCP service on a server, you must configure it. No matter what NOS you are using, there are several configuration parameters that all DHCP servers will need. These parameters are as follows :
Configuring these parameters on a DHCP server is a fairly straightforward matter. For example, on a server running Windows Server 2003, a New Scope Wizard is used to create the scope, create exclusions, and configure other DHCP parameters. This wizard is run from the DHCP snap-in, which is installed on the server when you add the DHCP server role to the Windows configuration. Figure 12.5 shows the New Scope Wizard.
Figure 12.5. The New Scope Wizard is used to create the IP address scope for the DHCP server.
As already mentioned, DHCP is managed using the DHCP snap-in on a server running Windows Server 2003. The snap-in allows you to add additional scopes, view IP address leases, and otherwise manage the DHCP service. Figure 12.6 shows the DHCP snap-in.
Figure 12.6. The DHCP snap-in is used to manage the DHCP service on a Windows server.
On a NetWare server, an administrator can manage the different aspects of the DHCP service from the NetWare iManager. The iManager provides the ability to create scopes and manage leases on the network. Figure 12.7 shows the iManager and the scope creation utility.
Figure 12.7. The Novell iManager is used to manage DHCP on the NetWare network.
Once the DHCP server is up and running on the network, the DHCP clients can begin to request IP address leases. Now while DHCP seems to be a fairly automatic service, it does require active management from a network administrator. And all the ins and outs of DHCP management are certainly beyond the level of coverage that we can provide in an introductory book.
For example, deployment issues related to DHCP require planning. The number of DHCP servers you deploy on the network should be directly related to the number of network clients on the network (to handle all those requests for IP address leases). In situations where you have a network that is segmented into subnets by routers, you will have to decide whether you deploy DHCP servers on every subnet or use a DHCP Relay Agent to help clients on subnets that do not have a DHCP server acquire IP addresses from the available DHCP servers on the network.
One thing that you should take away from our discussion of DHCP is that it typically cuts down on the number of IP configuration problems that will be introduced to the network. This is because once you set up the scope and other DHCP parameters, it basically takes care of IP addressing automatically.
Think of the large number of possible errors that could be introduced to computers on the network if you configured each one of them individually with a static IP address and subnet mask. If you assign the same IP address inadvertently to two devices, neither will be able to connect. If you type an address incorrectly in the client's TCP/IP configuration, again, the client won't be able to connect. So, DHCP is not only a time saver (since you don't have to configure clients individually) but it will cut down on communication problems related to IP addressing errors (since there shouldn't be any if you set up the DHCP server correctly).