Move host from one range to another one

Ivan V. Borodin vanchik at
Mon Aug 7 13:36:01 UTC 2006

В пт, 04/08/2006 в 20:05 +0100, Simon Hobson пишет:

> Ahh, I see the problem now !
> I cannot see any way around it other than by deleting all leases for 
> that client in the 'guest' pool. I'm not even sure if that will work 
> since if the client comes along and asks for the address it last had 
> (in the guest pool) then it will be given it if it is available (ie 
> not currently leased to something else).
> So, I think that to make your system work you will need to :
> - remove all reference to that clients leases in the guest pool.
> - create a dummy lease to a non-existant client so that when the real 
> client comes to renew it's lease, the address will be in use, and so 
> it cannot retain it.
> - possibly create a lease skeleton to make the clients MAC address 
> 'sticky' with the desired new IP address (otherwise it could just get 
> another address in the guest pool).
> Unless you can manage it with omshell, then all will involve stopping 
> the server and processing the lease database. Alternatively you would 
> need to edit the server code to provide hooks for the specific 
> functions you need (delete all leases for address a.b.c.d, create 
> dummy lease).
> I assume the clients MAC address does get passed through by the cable 
> modem and are stored with the leases ? If so then the leases will be 
> 'sticky' once issued, but you will have the same problem every time a 
> client changes their mac address (swaps out a PC for example).
> I believe this is something that would be made easier in a future 
> release of the server - where it it is planned have reserved leases, 
> a bit like host statements but more flexible. However, major work on 
> the current server is being held back while an IP6 implementation is 
> done, so it might be a while before reserved leases appear.
> Simon

Probably I found a way to do what I need:

######## all config is the same, except guest pool ########
        pool {
                min-secs 1;
                if (option dhcp-message-type = 1) {
                        if not (suffix(hardware, 6) = 0:0:0:0:0:0) {
                                log(error, concat(
                                        binary-to-ascii(16, 8, ":", suffix(hardware, 6)),",",
                                        binary-to-ascii(10, 8, ".", leased-address))
                deny  known-clients;
                max-lease-time     3600;

dhcpd.errors are logged separately into some file, and there is a Perl
script which reads it. When script sees 'RESET_LEASE,HWADDR,IPADDR' it
prepares following text file:

new "lease"
set hardware-address = HWADDR
set ip-address = IPADDR
set state = 0:0:0:6  <- this is reset

then it runs `omshell < above_file`

it works in most cases.

Where can I read more about lease-object states? What is dhcpd behavior
with different leases states?
'man dhcpd' contains enum only.

Some info:

RFC2131 (I read this one: says:

3.2 Client-server interaction ......

4.    The client may choose to relinquish its lease on a network
      address by sending a DHCPRELEASE message to the server.  The
      client identifies the lease to be released with its
      'client identifier', or 'chaddr' and network address in the
      DHCPRELEASE message.

      Note that in this case, where the client retains its network
      address locally, the client will not normally relinquish its
      lease during a graceful shutdown.  Only in the case where the
      client explicitly needs to relinquish its lease, e.g., the client
      is about to be moved to a different subnet, will the client send
      a DHCPRELEASE message.

so I believe it is reasonable to parse pools etc from top to bottom (as
it described in dhcpd.conf manpage) in case if previously leased address
is released by client. Exactly my case is mentioned in RFC-text above:
client is about to be moved to a different subnet.


Ivan V. Borodin

More information about the dhcp-users mailing list