DHCP lease states and expire leases

Peter Rathlev peter at rathlev.dk
Mon Jun 17 21:20:38 UTC 2019


On Fri, 2019-06-14 at 14:17 +0000, King, Harold Clyde (Hal) wrote:
> I can’t seem to find the explation of lease states on google or my
> books. I see it used in Windows, but I’m in ISC. I can set the state,
> but I’m not sure of all the state numbers.
>  
> For instance, a lease with a state of 1 is free?
> And a lease of state 7 is taken?

You can see the numeric values of lease states in includes/dhcpd.h
around line 533 in 4.4.1:

/* Lease states: */
#define FTS_FREE        1
#define FTS_ACTIVE      2
#define FTS_EXPIRED     3
#define FTS_RELEASED    4
#define FTS_ABANDONED   5
#define FTS_RESET       6
#define FTS_BACKUP      7

So yeah, 1 is free. State 7 is "backup" which means that it's free for
use by the failover partner. Only 2/active means that it's in use.

> I’m trying to expire leases and have clients be able to get those
> leases. I think I have with a state of 1, but my clients get a peer
> holds free leases.

You could use omshell to simulate that the lease was released and then
move it to "free" afterwards. Something like this, where I have
excluded the state output omshell places after each command:

$ omshell
> server 127.0.0.1
> key <keyname> <secret>
> new lease
> set ip-address = 192.0.2.10
> open
> set state = 4
> update
> set state = 1
> update
> close

This effectively moves the lease to state "relased" and the "free". It
cannot go directly to "free", that's an invalid state transition. Doing
so might work on the local server but the failover partner would reject
the update.

You could also just mark it released and let dhcpd do its thing like
normally. As far as I understand, setting state 4/released has the
exact same effect as if the client sent a "RELEASE" packet to the
server.

HTH.

-- 
Peter




More information about the dhcp-users mailing list