Subject: Re: dhcpd address assignment
To: matthew sporleder <msporleder@gmail.com>
From: Steven M. Bellovin <smb@cs.columbia.edu>
List: netbsd-users
Date: 02/02/2006 10:49:51
>My two guesses are:
>1) It might have something to do with the request coming after the T1
>time (half the lease time), and it wasn't renewed then,

No; I repeated the experiment soon enough that it was still fresh.  
Besides, the RFC says that even expired leases should be renewed if 
possible.
>
>2) or (more likely) the server doesn't look for an existing lease
>unless the client asks for an address (REQUEST) that's different from
>the one OFFERed.
>
>Some tcpdumping in both situations could probably shed some light on it.
>

Oh, I don't think I need tcpdump.  The server log and the client dialog 
show just a DISCOVER, not a REQUEST, since the client doesn't have any 
idea what its old address was.  The problem is that the OFFER from the 
server is for a different address.

> The laptop was given a lease by dhcpd; that lease was recorded in
> dhcpd.leases.  I stopped dhclient on the laptop, truncated the
> dhclient.leases file, and restarted dhclient.  dhcpd on the server
> gave it a different address.  Why?

>As far as I can tell, the ISC dhcp software doesn't make an effort to reassign
>the same IP to the machine which used to have the lease if that machine asks f
>or
>an entirely new lease.  If the client asks to renew a lease as it expires, it
>will get the prior IP, though.

Yup, that's what I'm seeing; I was wondering why.
>
>> Section 4.3.1 of RFC 2131 seems to imply that the previous address
>> should be reused.
>
>Agreed.  You might try using the OpenBSD version of dhcpd; I've heard they are
>trying to work on some of these issues that the ISC version doesn't bother wit
>h.

Hmm -- interesting thought.
>
>> I did not see any relevant options in the dhcpd.conf man page.  I do not
>> have any static addresses assigned in my dhcpd.conf file.
>
>Of course, setting up a static address via DHCP is the ideal solution to this
>problem...

I may have to; thanks.

		--Steven M. Bellovin, http://www.cs.columbia.edu/~smb