Products . Tiny DHCP Server . Protocol Description

What is DHCP?
Tiny DHCP Server

DHCP stands for Dynamic Host Configuration Protocol. It is a protocol which enables a computer that is connected to a network to obtain its configuration (mainly, its network configuration) dynamically (i.e. without special intervention). You only have to specify to the computer to find a stand alone IP address by DHCP. The main aim being to simplify network administration.

The DHCP protocol mainly serves to distribute IP addresses on a network, but was designed from the start as a complement to the BOOTP protocol (Bootstrap Protocol) which is used for example when installing a machine across a network (BOOTP is used closely with a TFTP server upon which the client will find the files to be loaded and copied onto the hard disk). A DHCP server can send back the BOOTP parameters or the configuration specific to a given host.

How does DHCP protocol works?

Firstly, a DHCP server is needed which distributes the IP addresses. This machine will serve as a base for all DHCP requests and must also have a fixed IP address. Therefore, on a network there can only be one machine with a fixed IP address, the DHCP server.

The basic communication system is BOOTP (with UDP frame). When a machine is turned on, it has no information on its network configuration, and there is nothing special that the user needs to do to find an IP address. In order to do this, the technique used is the broadcast: to find and talk with a DHCP server, the machine will simply send a special broadcast packet (broadcast on with other information such as the type of request, the connection ports, etc.) over the local network. When the DHCP receives the broadcast packet, it will send back another broadcast packet (do not forget that the client does not obviously have the IP address and that therefore cannot be connected to directly) containing all the information required for the client.

It could be believed that one single packet is enough for the protocol to work. In fact, there are several types of DHCP packets likely to be issued either by the client for the server(s), or by the servers to a client:

DHCPDISCOVERto locate available DHCP servers
DHCPOFFERserver response to a DHCPDISCOVER packet, which contains the initial parameters
DHCPREQUESTvaried request from the client for example to extend its lease
DHCPACKserver response which contains the parameters and IP address of the client
DHCPNAKserver response to indicate to the client that its lease has expired or if the client announces a bad network configuration
DHCPDECLINEthe client announces to the server that the address is already in use
DHCPRELEASEthe client releases its IP address
DHCPINFORMthe client requests local parameters, it already has its IP address

The first packet issued by the client is a DHCPDISCOVER type packet. The server responds with a DHCPOFFER packet, particularly in order to submit an IP address to the client. The client establishes its configuration and then makes a DHCPREQUEST to validate its IP address (a broadcast request since DHCPOFFER does not contain the IP address). The server simply responds with a DHCPACK with the IP address for confirmation of the allocation. Normally, this is enough for the client to obtain an effective network configuration, but it can be longer or shorter according to whether the client accepts the IP address or not...


In order to optimise network resources, the IP addresses are delivered with a start and end date for their validity. This is what is known as a "lease". A client that sees its lease expire can ask the server for an extension of the lease by a DHCPREQUEST. Likewise, when the server sees a lease expire, it will send a DCHPNAK to ask the client if it wants to extend its lease. If the server does not receive a valid response, it will make the IP address available.

This is the subtlety of DHCP: allocation of IP addresses can be optimised by playing on the lease durations. The problem is that if no address is released at the end of a certain time limit, no further DHCP request can be satisfied due to a lack of addresses to distribute.

On a network where many computers are connecting and disconnecting regularly (school or sales office network for example), it is good to offer short term leases. Conversely, on a network mostly comprised of fixed machines, seldomly rebooted, long term leases are sufficient. Do not forget that DHCP mainly works by broadcast, and that it can take up bandwidth on small networks with high demand.

Copyright © 1999-2020 SoftCab, Inc. All Rights Reserved · 0.00098 seconds