DHCP Dynamic Host Configuration Protocol (Farsi User Guide)
Resource: Windows 2000 Server Resource kit TCP/IP Core Networking Guide

Winteacher.com > Part2 > DHCP > DHCP Lease Process

DHCP Lease Process

سرور DHCP از یک Range مشخص شده به DHCP Client آدرس IP اجاره می دهد این فرایند مدت زمان مشخصی دارد و قبل از Expire شدن مدت زمان DHCP Serv دوباره به سراغ Client رفته

برای اجاره دادن یک IP Address جدید .

DHCP Messages
Message Type Description
DHCPDiscover The first time a DHCP client computer attempts to log on to the network, it requests IP address information from a DHCP server by broadcasting a DHCPDiscover packet. The source IP address in the packet is because the client does not yet have an IP address. The message is either 342 or 576 bytes long—older versions of Windows use a longer message frame.
DHCPOffer Each DHCP server that receives the client DHCPDiscover packet responds with a DHCPOffer packet containing an unleased IP address and additional TCP/IP configuration information, such as the subnet mask and default gateway. More than one DHCP server can respond with a DHCPOffer packet. The client will accept the first DHCPOffer packet it receives. The message is 342 bytes long.
DHCPRequest When a DHCP client receives a DHCPOffer packet, it responds by broadcasting a DHCPRequest packet that contains the offered IP address, and shows acceptance of the offered IP address. The message is either 342 or 576 bytes long, depending on the length of the corresponding DHCPDiscover message.
DHCPAcknowledge (DHCPAck) The selected DHCP server acknowledges the client DHCPRequest for the IP address by sending a DHCPAck packet. At this time the server also forwards any optional configuration parameters. Upon receipt of the DHCPAck, the client can participate on the TCP/IP network and complete its system startup. The message is 342 bytes long.

چند نوع پیغام میان DHCP Serv و DHCP Client ردوبدل می شود که در زیر شرح کامل آنها را مشاهده می کنید .در شکل 4.2 می توان این مراحل را دید .

Figure 4.2 The DHCP Lease Process

  1. The DHCP client requests an IP address by broadcasting a DHCPDiscover message to the local subnet.
  2. The client is offered an address when a DHCP server responds with a DHCPOffer message containing an IP address and configuration information for lease to the client. If no DHCP server responds to the client request, the client can proceed in two ways:
    • If it is a Windows 2000–based client, and IP auto-configuration has not been disabled, the client self-configures an IP address for its interface.
    • If the client is not a Windows 2000–based client, or IP auto-configuration has been disabled, the client network initialization fails. The client continues to resend DHCPDiscover messages in the background (four times, every 5 minutes) until it receives a DHCPOffer message from a DHCP server.
  3. The client indicates acceptance of the offer by selecting the offered address and replying to the server with a DHCPRequest message.
  4. The client is assigned the address and the DHCP server sends a DHCPAck message, approving the lease. Other DHCP option information might be included in the message.
  5. Once the client receives acknowledgment, it configures its TCP/IP properties using any DHCP option information in the reply, and joins the network



سیستم وقتی وارد شبکه می شود یک Packet از نوع Broadcast

به شبکه ارسال می  کند تا DHCP Serv را پیدا کند . این به این دلیل می باشد وقتی

 سیستم برای اولین بار می خواهد با سرور ارتباط برقرارکند آدرس آن را ندارد

به همین دلیل Broadcast می کند.

Figure 4.5 The Initialization State

When the DHCP client is in this state, its IP address is To obtain a valid address, the client broadcasts a DHCPDiscover message from UDP port 68 to UDP port 67, with a source address of and a destination of (the client does not yet know the address of any DHCP servers). The DHCPDiscover message contains the DHCP client's media access control address and computer name.

-- -

وقتی یک DHCP Serv پیغام DHCPDiscover را دریافت کند

در جواب این Packet را ارسال می کند که محتوای آن آدرسهای که آماده

اجاره دادن می باشد و نیز موارد تنظیمی Admin در Scope می باشد

مانند Default Gateway و غیره .

Figure 4.6 The Selecting State
Next, the client moves into the Selecting state, where it chooses a DHCPOffer. All DHCP servers that receive a DHCPDiscover message and have a valid IP address to offer the DHCP client respond with a DHCPOffer message sent from UDP port 68 to UDP port 67. The DHCPOffer is sent via the media access control and IP broadcast because the DHCP client does not yet have a valid IP address that can be used as a destination. The DHCP server reserves the IP address to prevent it from being offered to another DHCP client.

The DHCPOffer message contains an IP address and matching subnet mask, a DHCP server identifier (the IP address of the offering DHCP server), and a lease duration. Figure 4.6 shows the Selecting state.

The DHCP client waits for a DHCPOffer message. If a DHCP client does not receive a DHCPOffer message from a DHCP server on startup, it will retry four times (at intervals of 2, 4, 8, and 16 seconds, plus a random amount of time between 0 and 1,000 milliseconds). If a DHCP client does not receive a DHCPOffer after four attempts, it waits 5 minutes, then retries at 5-minute intervals.

-- -

زمانی که Client پیغام DHCPOffer را دریافت کرد این Packet

را ارسال می کند مبنی بر اینکه آدرس و بقیه Configuration

پیشنهاد شده از طرف DHCP Serv را قبول کرده .

Figure 4.7 The Requesting State
After a DHCP client has received a DHCPOffer message from a DHCP server, the client moves into the Requesting state. The DHCP client knows the IP address it wants to lease, so it broadcasts a DHCPRequest message to all DHCP servers. The client must use a broadcast because it still does not have an assigned IP address. Figure 4.7 shows the Requesting state.

If the IP address of the client was known (that is, the computer restarted and is trying to lease its previous address), the broadcast is looked at by all of the DHCP servers. The DHCP server that can lease the requested IP address responds with either a successful acknowledgment (DHCPAck) or an unsuccessful acknowledgment (DHCPNak). The DHCPNak message occurs when the IP address requested is not available or the client has been physically moved to a different subnet that requires a different IP address. After receiving a DHCPNak message, the client returns to the Initializing state and begins the lease process again.

If the IP address of the client was just obtained with a DHCPDiscover or DHCPOffer exchange with a DHCP server, the client puts the IP address of that DHCP server in the DHCPRequest. The specified DHCP server responds to the request, and any other DHCP servers retract their DHCPOffer. This ensures that the IP addresses that were offered by the other DHCP servers go back to an available state for another DHCP client.

-- -

در مرحله آخر DHCP Serv موارد پیشنهادی را بروی Client اعمال می کند .

Figure 4.8 The Binding State
The DHCP server responds to a DHCPRequest message with a DHCPAck message. This message contains a valid lease for the negotiated IP address, and any DHCP options configured by the DHCP administrator. Figure 4.8 shows the Binding state.

The DHCPAck message is sent by the DHCP server using an IP broadcast. When the DHCP client receives the DHCPAck message, it completes initialization of the TCP/IP stack. It is now considered a bound DHCP client that can use TCP/IP to communicate on the network.

The IP address remains allocated to the client until the client manually releases the address, or until the lease time expires and the DHCP server cancels the lease.

-- -

معمولا اگر 50% از مدت زمان اجاره یک IP Address گذشته باشد Client

اقدام به ارسال DHCPREQUEST به DHCP Serv می کند

برای تمدید اجاره IP که دارد .این عمل با جواب DHCPAck پایان می یابد .

Figure 4.9 Renewing State
IP addressing information is leased to a client, and the client is responsible for renewing the lease. By default, DHCP clients try to renew their lease when 50 percent of the lease time has expired. To renew its lease, a DHCP client sends a DHCPRequest message to the DHCP server from which it originally obtained the lease.

The DHCP server automatically renews the lease by responding with a DHCPAck message. This DHCPAck message contains the new lease as well as any DHCP option parameters. This ensures that the DHCP client can update its TCP/IP settings in case the network administrator has updated any settings on the DHCP server. Figure 4.9 illustrates the Renewing state.

Once the DHCP client has renewed its lease, it returns to the Bound state. Renewal messages (DHCPRequest and DHCPAck) are sent by media access control and IP-level unicast traffic.

-- -
Restarting a DHCP Client

زمانی که یک DHCP Client  که قبلا ازسرور IP  اجاره کرده بوده در شبکه Restart می شود دیگر DHCPDiscover در شبکه Broadcast نمی کند بلکه DHCPRequest برای سرور ارسال می کند

در این Packet آدرس قبلی نیز وجود دارد .سرور DHCP این ادرس را تست می کند اگر به Client دیگری این آدرس را نداده باشد دوباره همان آدرس قبلی را به Client می دهد در غیره این صورت آدرس جدید به

DHCP Client داده می شود .

DHCP Dynamic Host Configuration Protocol (Farsi User Guide)


Winteacher.com > Part2 > DHCP > DHCP Lease Process