To enable devices to obtain an address by DHCP, a DHCP server must be running on the network. The server does not need to contain any pre-assigned mapping between MAC (hardware) addresses and IP numbers; however, it is possible to make such a mapping if it is necessary that a particular computer always get the same IP address through DHCP.
On the client side, it is simply necessary that a DHCP client run when the system boots. The client will then obtain an address (and other network information) from the server when it is booted and all will be well.
The interaction between the client and the server takes place is in four stages:
1. The client sends out a broadcast DHCPDISCOVER request packet to the network. As the client obviously has no IP address at this stage, it uses 0.0.0.0 as the source address.
2. If there is a DHCP server on the network, it sends out a response to the client's MAC address. This response is a DHCPOFFER and contains the IP address of the server.
3. The client receives the DHCPOFFER and responds to it with a broadcast DHCPREQUEST including the IP address of the particular server to which it is making the request.
4. The chosen server sends a DHCPACK response that contains the network configuration information required by the client, which can then configure itself accordingly.
The DHCP server provides what is called a lease on an IP address for the client. The lease is valid for a specified period of time, after which it will be renewed. The lease time is configurable and is expressed as a number in seconds in the configuration file. Information about DHCP leases is written to the file / var/lib/dhcp/db/dhcpd.leases on the server.
Was this article helpful?