dhcp fails with big dhcpd.leases

sthaug at nethelp.no sthaug at nethelp.no
Wed Sep 1 06:58:50 UTC 2010

> I do not remember whole dhcp protocol. So I don't know what it is really
> exchanged between client and server.
> But according my -maybe naive consideration- the host should be able to
> ask for a quite new IP without querying for assigning the "old" one.
> Especially when it tries to get dhcp data connecting  totally fresh
> network: there is no address to ask about.
> > If there is no Request, then the server has nothing to Ack.
> Ok. I undestand - the DHCPACK is posted only when the host asks about
> the IP address and the IP is confirmed.

You need to understand the basic DHCP protocol. This is vitally important
if you run a reasonably large DHCP installation. How many clients do you

The basic message exchange (assuming the server has an address to offer):

Client:	  Discover
Server:	  Offer
Client:	  Request
Server:	  Ack

*Later*, when a client wants to renew the same IP address it already  has,
the typical sequence is:

Client:   Request
Server:   Ack

> > But deleting the leases file DOES fundamentally break your server config.
> Well. So, was Sten Carlsen wrong writing " The leases file is a log file
> - the server only ever appends to it, and during operations it never
> reads from it." ?

Sten Carlsen was right. The file is not read during normal *running*
operation of the dhcpd process. However, the leases file is needed for
*restarts* of the dhcpd process - this is when the DHCP server is
expected to "regain" previous knowledge about leases. You are breaking

> Because if he was right deleting lease file (during server run time)
> should not break the server - or there is a bug in the software as
> writing to opened (i.e using file handle to) file  which has been
> removed should be detected in the software.

If you delete the leases file while the dhcpd process is running, I would
expect the following to happen:

- The space is not freed, because the dhcpd process still has the file
- Each hour the dhcpd process rewrites the leases file - which in your
case means that the file would appear to be recreated.

> I know that noone assumes such stupid user action but for the services
> running 24/24 everything may happen - the file system can crash (or
> whole HDD having the partition with this file can corrupt) so such
> service should "behave correctly" and report the error in other way.

The dhcpd process is based on having enough space for the leases file,
and being able to *read* leases data from this file when it starts. You
are fundamentally breaking this. As long as you keep breaking this, you
will continue to have problems.

There are lots of us running DHCP services 24 x 7 without problems. We
do this by making sure that the DHCP servers have enough disk space, and
by carefully monitoring the DHCP services. If you want to ensure that 
you cannot run out of disk space for the leases file: Put the file on
its own file system partition (and make sure that partition is several
times as large as the largest lease file expected).

Steinar Haug, Nethelp consulting, sthaug at nethelp.no

More information about the dhcp-users mailing list