Appendix C -- Understanding the DHCP Service
The Dynamic Host Configuration Protocol (DHCP) Service in Microsoft Windows 2000 centralizes and manages the allocation of Microsoft Transmission Control Protocol/Internet Protocol (TCP/IP) configuration information by assigning Internet Protocol (IP) addresses automatically to computers that are configured as DHCP clients. Implementing the DHCP Service can eliminate many of the configuration problems associated with configuring TCP/IP manually.To introduce you to DHCP, the following six topics are covered in this appendix:
The Bootstrap Protocol (BOOTP)Manual versus automatic TCP/IP configurationThe requirements for a server running the DHCP ServiceThe requirements for DHCP clientsThe DHCP lease processIP lease renewal and release
The Bootstrap Protocol
The Bootstrap Protocol, based on the User Datagram Protocol/Internet Protocol (UDP/IP), enables a booting host to configure itself dynamically. DHCP is an extension of BOOTP, which enables diskless clients to start up and automatically configure TCP/IP. Each time that a DHCP client starts, it requests IP addressing information from a DHCP server, including the following:
An IP addressA subnet maskOptional values, such as the following:
A default gateway addressA Domain Name System (DNS) server addressA Windows Internet Name Service (WINS) server address
When a DHCP server receives a request for an IP address, it selects IP addressing information from a pool of addresses that are defined in its database and
offers the IP addressing information to the DHCP client, as shown in Figure C.1. If the client accepts the offer, the DHCP server leases the IP addressing information to the client for a specified period of time.
Figure C.1 A DHCP server provides IP addresses to DHCP clients
Manual Versus Automatic TCP/IP Configuration
To understand why the DHCP Service is beneficial for configuring TCP/IP on clients, it is useful to contrast the manual method of configuring TCP/IP with the automatic method using DHCP, as shown in Table C.1.Table C.1 Configuring TCP/IP Manually Versus Using the DHCP Service
Configuring TCP/IP manually | Configuring TCP/IP using DHCP |
---|---|
Users can pick an IP address randomly rather than obtaining a valid IP address from the network administrator. Using incorrect addresses can lead to network problems that can be difficult to trace to the source. | Users no longer need to acquire IP addressing information from an administrator to configure TCP/IP. The DHCP Service supplies all the necessary configuration information to all the DHCP clients. |
Typing the IP address, subnet mask, or default gateway can lead to problems ranging from difficulty communicating, if the default gateway or subnet mask is incorrect, to problems associated with a duplicate IP address. | Correct configuration information ensures correct configuration, which eliminates most difficult-to-trace network problems. |
There is administrative overhead for networks if you frequently move computers from one subnet to another. For example, you must change the IP address and default gateway address for a client to communicate from a new location. | Having servers running the DHCP Service on each subnet eliminates the overhead of having to manually reconfigure IP addresses, subnet masks, and default gateways when you move computers from one subnet to another. |
Requirements for a Server Running the DHCP Service
A DHCP server requires a computer running Windows 2000 Server that is configured with the following:
The DHCP Service.A static IP address (it can't be a DHCP client itself), subnet mask, default gateway (if necessary), and other TCP/IP parameters.A DHCP scope. A scope is a range of IP addresses that are available for lease or assignment to clients.
Requirements for DHCP Clients
A DHCP client requires a computer that is DHCP-enabled and running any of the following supported operating systems:
Windows 2000, Windows NT Server version 3.51 or later, or Windows NT Workstation version 3.51 or later.Microsoft Windows 95 or later.Windows for Workgroups version 3.11 running Microsoft TCP/IP-32, which is included on the Windows 2000 Server CD-ROM.Microsoft Network Client version 3 for Microsoft MS-DOS with the real-mode TCP/IP driver, which is included on the Windows 2000 Server CD-ROM.LAN Manager version 2.2c, which is included on the Windows 2000 Server CD-ROM. LAN Manager 2.2c for OS/2 is not supported.
The DHCP Lease Process
To understand the DHCP lease process, you must first understand when the lease process occurs. The DHCP lease process occurs when one of the following events happens:
TCP/IP is initialized for the first time on a DHCP client.A client requests a specific IP address and is denied, possibly because the DHCP server dropped the lease.A client previously leased an IP address but released the IP address and requires a new one.
DHCP uses a four-phase process to lease IP addressing information to a DHCP client for a specific period of time: DHCPDISCOVER, DHCPOFFER, DHCPREQUEST, and DHCPACK. (See Figure C.2.)
Figure C.2 The DHCP lease process
The DHCPDISCOVER Phase
The first phase in the DHCP lease process is DHCPDISCOVER. To begin the DHCP lease process, a client initializes a limited version of TCP/IP and broadcasts a DHCPDISCOVER message requesting the location of a DHCP server and IP addressing information. Because the client doesn't know the IP address of a DHCP server, the client uses 0.0.0.0 as the source address and 255.255.255.255 as the destination address.The DHCPDISCOVER message contains the client's hardware address and computer name so that the DHCP servers can determine which client sent the request.
The DHCPOFFER Phase
The second phase in the DHCP lease process is DHCPOFFER. All DHCP servers that receive the IP lease request and have a valid client configuration broadcast a DHCPOFFER message that includes the following information:
The client's hardware addressAn offered IP addressA subnet maskThe length of the leaseA server identifier (the IP address of the offering DHCP server)
The DHCP server sends a broadcast because the client doesn't yet have an IP
address. The DHCP client selects the IP address from the first offer that it
receives. The DHCP server that is issuing the IP address reserves the address
so that it can't be offered to another DHCP client.
The DHCPREQUEST Phase
The third phase in the DHCP lease process occurs after the client receives a DHCPOFFER from at least one DHCP server and selects an IP address. The
client broadcasts a DHCPREQUEST message to all DHCP servers, indicating that it has accepted an offer. The DHCPREQUEST message includes the server identifier (IP address) of the server whose offer it accepted. All other DHCP servers then retract their offers and retain their IP addresses for the next IP lease request.
The DHCPACK Phase
The final phase in a successful DHCP lease process occurs when the DHCP server issuing the accepted offer broadcasts a successful acknowledgment to the client in the form of a DHCPACK message. This message contains a valid lease for an IP address and possibly other configuration information.When the DHCP client receives the acknowledgment, TCP/IP is completely initialized and the client is considered a bound DHCP client. Once bound, the client can use TCP/IP to communicate on the network.
The DHCPNACK Message
If the DHCPREQUEST is not successful, the DHCP server broadcasts a negative acknowledgement (DHCPNACK). A DHCP server broadcasts a DHCPNACK if
The client is trying to lease its previous IP address, and the IP address is no longer available.The IP address is invalid because the client physically has been moved to a different subnet.
When the client receives an unsuccessful acknowledgment, it resumes the DHCP lease process.NOTEIf a computer has multiple network adapters that are bound to TCP/IP, the DHCP process occurs separately over each adapter. The DHCP Service assigns a unique IP address to each adapter in the computer that is bound to TCP/IP.
IP Lease Renewal and Release
All DHCP clients attempt to renew their lease when 50 percent of the lease time has expired. To renew its lease, a DHCP client sends a DHCPREQUEST message directly to the DHCP server from which it obtained the lease. If the DHCP server is available, it renews the lease and sends the client a DHCPACK message with the new lease time and any updated configuration parameters, as shown in Figure C.3. The client updates its configuration when it receives the acknowledgment.
Figure C.3 Renewing an IP lease
NOTEEach time a DHCP client restarts, it attempts to lease the same IP address from the original DHCP server. If the lease request is unsuccessful and lease time is still available, the DHCP client continues to use the same IP address until the next attempt to renew the lease.If a DHCP client can't renew its lease with the original DHCP server at the 50 percent interval, the client broadcasts a DHCPREQUEST to contact any available DHCP server when 87.5 percent of the lease time has expired. Any DHCP server can respond with a DHCPACK message (renewing the lease) or a DHCPNACK message (forcing the DHCP client to reinitialize and obtain a lease for a different IP address).If the lease expires, or if a DHCPNACK message is received, the DHCP client must immediately discontinue using that IP address. The DHCP client then
begins the DHCP lease process to lease a new IP address.
Using Ipconfig to Renew a Lease
Use the ipconfig command with the /renew switch to send a DHCPREQUEST message to the DHCP server to receive updated options and lease time. If the DHCP server is unavailable, the client continues using the current DHCP-
supplied configuration options.
Using Ipconfig to Release a Lease
Use the ipconfig command with the /release switch to cause a DHCP client to send a DHCPRELEASE message to the DHCP server and to release its lease. This is useful when you are moving a client to a different network and the client will not need its previous lease. TCP/IP communications with the client will stop after you issue this command.Microsoft DHCP clients don't initiate DHCPRELEASE messages when shutting down. If a client remains shut down for the length of its lease (and the lease is not renewed), the DHCP server might assign that client's IP address to a different client after the lease expires. A client has a better chance of receiving the same IP address during initialization if it doesn't send a DHCPRELEASE message.