Logging DHCP lease duration in seconds
Denis Laventure
Denis_Laventure at uqac.ca
Fri Oct 2 19:51:37 UTC 2015
The client will renew the lease at half the max-lease-time. So seeing 150 sec for a 300 sec lease seems normal.
Hi,
I have an easy question I believe, I want to log DHCP lease durations given to clients, I tried the following, however it appears most of the time, logs are showing half of the lease duration.
log(info, concat( "IP: ", binary-to-ascii(10, 8, ".", leased-address), " ; ", "leasetime:", binary-to-ascii(10,32,"",encode-int(lease-time,32)) ));
I have set the following lease time values for a pool:
subnet 172.16.2.0 netmask 255.255.255.0 {
option routers 172.16.2.1;
pool {
failover peer "failover-partner";
default-lease-time 300;
min-lease-time 300;
max-lease-time 300;
range 172.16.2.10 172.16.2.250;
}
}
And this configuration produces an output like this:
Oct 2 14:34:44 mercan dhcpd: IP: 172.16.2.127 ; leasetime:155
Oct 2 14:37:10 mercan dhcpd: IP: 172.16.2.127 ; leasetime:154
Oct 2 14:37:13 mercan dhcpd: IP: 172.16.2.127 ; leasetime:297
Oct 2 14:39:37 mercan dhcpd: IP: 172.16.2.127 ; leasetime:156
Oct 2 14:42:03 mercan dhcpd: IP: 172.16.2.127 ; leasetime:154
Oct 2 14:44:28 mercan dhcpd: IP: 172.16.2.127 ; leasetime:155
Oct 2 14:46:53 mercan dhcpd: IP: 172.16.2.127 ; leasetime:155
Oct 2 14:49:18 mercan dhcpd: IP: 172.16.2.127 ; leasetime:155
Oct 2 14:49:54 mercan dhcpd: IP: 172.16.2.127 ; leasetime:264
Oct 2 14:50:47 mercan dhcpd: IP: 172.16.2.127 ; leasetime:247
Oct 2 14:51:18 mercan dhcpd: IP: 172.16.2.127 ; leasetime:269
How can log the precise lease durations, would be great if anyone has any suggestions?
Thanks in advance.
Alp
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/dhcp-users/attachments/20151002/d472d2a2/attachment.html>
More information about the dhcp-users
mailing list