If I correctly understood, to make a static lease you have something like this in your config:
host static-1 {
hardware ethernet 00:01:02:03:04:05;
fixed-address 192.168.1.40;
}
This will work as you expect, but will never release this IP-address (it does not matter if client send DHCPRELEASE or not) - because it is STATIC IP from dhcpd's point of view.
You must create a DYNAMIC IP (again, from dhcpd's point of view), so dhcpd will track it. You can do it like this:
# First create pseudo class
class "static-ip" { match suffix(hardware, 6); }
# Here you will declare all MAC of your clients and make it a subclass of "static-ip"
# class "<UNIQ-CLASSNAME>" { match if suffix(hardware, 6) = <CLIENT-MAC-ADDRESS>; } subclass "static-ip" <CLIENT-MAC-ADDRESS>;
# Example
class "static-1" { match if suffix(hardware, 6) = 00:01:02:03:04:05; } subclass "static-ip" 00:01:02:03:04:05;
# Next allocate an address for every client (inside subnet declaration):
subnet 192.168.1.0 netmask 255.255.255.0 {
on commit {
set ip = binary-to-ascii (10, 8, ".", leased-address);
execute ("/usr/local/bin/dhcp-test", "commit", ip);
}
on release {
set ip = binary-to-ascii (10, 8, ".", leased-address);
execute ("/usr/local/bin/dhcp-test", "release", ip);
}
on expiry {
set ip = binary-to-ascii (10, 8, ".", leased-address);
execute ("/usr/local/bin/dhcp-test", "expiry", ip);
}
# pool { range <ip-addr>; allow members of "<UNIQ-CLASSNAME>"; }
pool { range 192.168.1.40; allow members of "static-1"; }
# pool { range 192.168.1.41; allow members of "static-2"; }
#... so on
}
To make your configuration more flexible, you can put class-subclass and pool-range declarations into different files and include them into main dhcpd.conf
#dhcpd.conf
authoritative;
min-lease-time ...;
... etc.
include "/path/to/classes.conf";
include "/path/to/subnet.conf";
As you can see, we put every client into its own class AND subclassed it into "static-ip" class. This is in case you want to have another subnet w/o static ip assignment, for ex.:
subnet 192.168.2.0 netmask 255.255.255.0 {
range 192.168.2.10 192.168.2.100;
deny members of "static-ip";
}
Then you must deny clients with static ip assignment to get IPs from this subnet (with deny keyword).
This way you get DYNAMIC IP (from dhcpd's point), but actually it will never change (from client's point)