Computers & ProgrammingBasic NetworkingComputers & Networking

The DHCP Process: Negotiating a Lease

The process of obtaining an IP address from a DHCP server is fairly simple and straightforward. This basic process, while taken for granted by many network administrators, is key in understanding how clients obtain and negotiate IP leases. The process of obtaining a valid IP address from a DHCP server can be broken down into four phases.

These four phases are as follows: DHCP Discover, DHCP Offer, DHCP Request, and DHCP Acknowledgement. Let’s examine these phases for a client that is simply plugged into the network. When the network interface is brought online, the process begins as follows:

DHCPDISCOVER

In the first phase, the client broadcasts messages on the subnet to discover all available DHCP servers. A network administrator can configure a DHCP Relay Agent on the gateway’s interface for relaying the broadcast packet directly to a DHCP server in situations where a DHCP server is not physically located on the same segment as the DHCP clients.

If a Relay Agent intercepts the packet, it will update the GIADDR (Gateway IP Address) field. This client creates a User Datagram Protocol (UDP) packet with the IP destination address of 255.255.255.255 (Broadcast).

Type:UDP
Source IP:0.0.0.0
Source Port:68
Destination IP:255.255.255.255
Destination Port:67

DHCPOFFER

When a DHCP server receives an IP lease request from a client, it immediately reserves an IP address for the client and extends an IP lease offer by sending a DHCPOFFER message to the client.

This message contains the client’s MAC address, 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. The DHCP server specifies the IP lease address in the YIADDR (Your IP Address) field.

Type:UDP
Source IP:DHCP Server’s IP
Source Port:67
Destination IP:255.255.255.255 (or DHCP Relay Agent IP if used)
Destination Port:68

DHCPREQUEST

A client can receive DHCP offers from multiple servers, but it will accept only one DHCP offer and broadcast a DHCP request message. Based on the Transaction ID field in the request, servers are informed about whose offer the client has accepted.

When other DHCP servers receive this message, they withdraw any offers that they might have made to the client and return the offered address to the pool of available addresses.

Type:UDP
Source IP:0.0.0.0
Source Port:68
Destination IP:255.255.255.255
Destination Port:67

DHCPACK

When the DHCP server receives the DHCPREQUEST message from the client, the configuration process enters its final phase. The acknowledgment 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 IP configuration process is completed. If the DHCP server is unable to offer the lease (especially for DHCP requests to renew an existing lease), the DHCP server will send a DHCP Negative Acknowledgement, or DHCPNACK, back to the client.

Type:UDP
Source IP:DHCP Server’s IP
Source Port:67
Destination IP:255.255.255.255 (or DHCP Relay Agent IP if used)
Destination Port:68

When DHCP clients already have an active lease in place, they will attempt to renew the lease at 50% of the lease time. For example, if the lease was issued for 8 days, the client will attempt to re-negotiate the lease at 4 days. If it is unsuccessful in contacting the DHCP server at that time, it will attempt again when it reaches 87.5% of the lease period.

If it is unsuccessful at this point, the client will continue regularly sending DHCPREQUEST packets until the lease is expired. Once the lease expires, the client will begin the process again from the DHCPDISCOVER phase. If the client is unsuccessful in obtaining an IP, by default, it will assign itself an APIPA address (Windows clients).

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top