Understanding How DHCP Works

DHCP is a broadcast-based protocol. A client is configured to obtain an IP address via DHCP and send a broadcast on start-up, trying to find one or more DHCP servers in the network. This is the DHCPDISCOVER packet. If a DHCP server sees this DHCPDISCOVER packet coming, it will answer with a DHCPOFFER packet. In that packet, it will offer an IP address and related information.

If the client receives a DHCPOFFER from more than one DHCP server, it will choose one of the offerings. It is difficult beforehand to determine with what IP configuration information the client will work; that is one of the reasons you should take care that no more than one DHCP server is available per broadcast domain to offer a configuration to the DHCP clients. To indicate that the client wants to use the IP address and related information that is offered by a DHCP server, it returns a DHCPREQUEST, thus asking to work with that information. The DHCP server then indicates that's OK by returning a DHCPACK (acknowledgment) to the client. From that moment on, the client can use the IP address.

Associated with each offering from a DHCP server is a lease time, which determines how long the client can use an IP address and the associated information. Before the lease ends, the client has to send a DHCPREQUEST again to renew its lease. In most cases, the server will answer to such a request by extending the lease period; in that case, the client receives a DHCPACK. If, for some reason, it is not possible to extend the lease, the client receives a DHCPNACK (negative acknowledgment). This indicates the client cannot continue its use of the IP address and associated information. If that happens, the client has to start the process all over again, beginning with the DHCPDISCOVER packet being sent over the network.

When the client machine is shut down, it lets the server know it no longer needs the IP address. In that case, it will send a DHCPRELEASE over the network. From that moment on, the IP address is available for use by other clients.

You should note that DHCP is a broadcast-based protocol. In other words, if the DHCP server is on a different subnet as the DHCP client, the client cannot reach it directly. If that's the case, a DHCP relay agent is needed, which forwards DHCP requests to a DHCP server. Later in the section "The DHCP Relay Agent," you will learn how to configure a DHCP relay agent.

Was this article helpful?

0 0

Post a comment