Running DHCP

Running DHCP

The basic DHCP process is a straightforward two-phase process involving a single DHCP client and at least one DHCP server. When the DHCP client (dhcpagent) is started on a client, it broadcasts a DHCPDISCOVER request for an IP address on the local network, which is received by all available servers running a DHCP server (in.dhcpd). Next, all DHCP servers that have spare IP addresses answer the client’s request through a DHCPOFFER message, which contains an IP address, a subnet mask, a default router name, and a DNS server IP address. If there are multiple DHCP servers that have IP addresses available, it is possible that multiple servers will respond to the client request. The client simply accepts the first DHCPOFFER that it receives, upon which it broadcasts a DHCPREQUEST message indicating that a lease has been obtained. Once the server has received this second request, it confirms the lease with a DHCPACK message. After a client has finished using the IP address, a DHCPRELEASE message is sent to the server.

In the situation where a server has proposed a lease in the first phase that it is unable to fulfill in the second phase, it must respond with a DHCPNACK message. This means that the client will then broadcast a DHCPDISCOVER message, and the process will start again. A DHCPNACK message is usually sent if a timeout has occurred between the original DHCPDISCOVER request and the subsequent reception at the server side of a DHCPREQUEST message. This is often due to network outages or congestion. The list of all possible DHCP messages is shown in Table 38-1.

Table 38-1: DHCP Codes and Their Meanings




Broadcast from client to all reachable servers.


Server responds to DHCPDISCOVER requests.


Client accepts lease proposal from only one server.


Server acknowledges lease.


Server refuses to accept DHCPREQUEST.


Lease no longer required.

The DHCPOFFER message specifies the lease period, after which the lease will be deemed to have expired and made available to other clients. However, clients also have the option of renewing an existing lease so that their existing IP address can be retained. The DHCP protocol defines fixed intervals prior to actual lease expiry, at which time a client should indicate whether or not it wishes to extend the lease. If these renewals are not made in time, a DHCPRELEASE message will be broadcast and the lease will be invalid.

DHCP has three ways to allocate leases to client. Automatic allocation grants an IP address permanently to a client. This is useful for granting IP addresses to servers that require a static IP address. A DNS server typically requires a static IP address that can be registered in host records lodged with InterNIC. The majority of clients will have addresses assigned dynamically by the server, which allows the greatest reuse of addresses. Alternatively, an administrator may manually assign an address to a specific client.

The process of allocating a DHCP lease is shown in Figure 38-1.

Click To expand Figure 38-1: How DHCP leases IP addresses.

Part I: Solaris 9 Operating Environment, Exam I