DHCP clients use two different processes to
communicate with DHCP servers and obtain a configuration. The
initialization process occurs when a client computer first starts and
attempts to join the network. The renewal process occurs after a client
has a lease but needs to renew that lease with the server.
Initial Lease
Process
The first time a
DHCP-enabled client starts, it automatically engages the following
initialization process to obtain a lease from a DHCP server:
1. | The DHCP client broadcasts a DHCP Discover message to
the local subnet.
|
2. | A DHCP
server can respond with a DHCP Offer message that contains an offered IP
address for lease to the client.
|
3. | If no DHCP
servers respond to the client discovery request, the client can proceed
in either of two ways:
If the client
is running Microsoft Windows 2000, the client configures itself with an
Automatic Private IP Addressing (APIPA) address. If the client is running
Microsoft Windows XP or a member of the Windows Server 2003 family, the
client configures itself with an alternate address (if provided). If no
static alternate address has been provided, the client configures itself
with an APIPA address.
If the client is running a version of Windows earlier than
Windows 2000, or if no static alternate address has been provided and IP
autoconfiguration has been disabled, the client fails to initialize. If
left running, it continues to resend DHCP Discover messages (4 times
every 5 minutes) until it receives a DHCP Offer message from a server.
|
4. | As soon as a DHCP Offer message is received, the
client selects the offered address by replying to the server with a DHCP
Request message.
Typically, the offering server sends a DHCP Acknowledgment (DHCP
ACK) message approving the lease. (DHCP options information is included
in the acknowledgment.)
|
5. | Once the
client receives acknowledgment, it configures its Transmission Control
Protocol/Internet Protocol (TCP/IP) properties using the information in
the reply and joins the network.
|
Figure 1 illustrates the lease process just described between the
DHCP server and client.
Lease Renewal
Process
When a DHCP client
shuts down and restarts, it typically obtains a lease for the same IP
address it had prior to the shutdown. Leases are also renewed after 50
percent (four days by default) of the client lease time elapses and when
the Ipconfig /renew command is executed on the client.
When the Ipconfig /renew
command is executed, the client tries to renew its lease with the DHCP
server as follows:
1. | The client sends a DHCP Request message directly to the
server that leased it, to renew and extend its current address lease.
|
2. | If the
server is reachable, it typically sends a DHCP ACK to the client, which
renews the current lease.
Also, as in the initial lease process, other DHCP options
information is included in this reply. If any options information has
changed since the client first obtained its lease, the client updates
its configuration accordingly.
|
3. | If the client is unable
to communicate with its original DHCP server, the client waits until it
reaches a rebinding state. By default,
this state occurs seven days after the last lease renewal. When the
client reaches this state, it attempts to renew its current lease with
any available DHCP server.
|
4. | If a
server responds with a DHCP Offer message to update the current client
lease, the client can renew its lease based on the offering server and
continue operation.
|
5. | If the
lease expires and no server has been contacted, the client must
immediately discontinue using its leased IP address.
|
6. | The client
then follows the same process used during its initial startup operation
to obtain a new IP address lease.
|
Note
In some cases,
a DHCP server can return a DHCP Negative Acknowledgment (DHCP NACK)
message to the client instead of the ACK in step 2. The NACK message is sent to a
client to indicate that the IP address that the client has requested
cannot be provided by the DHCP server. This situation can occur when a
client requests an invalid or duplicate address for the network. If a
client receives a negative acknowledgment, the lease renewal fails. In
this case, the client begins a new lease initialization process. |