DHCP and logging fixed address “leases”

dhcpdhcpd

I have been tooling with a dhcpd server that i have been setting up for, well, for the general excitement of it i guess.

I have a bunch of different configurations.

I have noticed that fixed-address records do not log into the dhcpd.leases file.

Is there a way to log them? I would like to be able to tell which clients are active.

I understand that these are somewhat analogous to BOOTP entries, and thus since they are always reserved for that MAC address or host identifier, it doesn't matter if they are used or not (thus perhaps unnecessary to log). But i would like to see them … now they are being used as DHCP address by the client and they are logging in syslog (as are the truly dynamic entries)

Jun 26 12:14:56 test dhcpd[8921]: DHCPREQUEST for 192.168.1.100 from aa:aa:aa:aa:aa:aa via eth0
Jun 26 12:14:56 test dhcpd[8921]: DHCPACK on 192.168.1.100 to aa:aa:aa:aa:aa:aa via eth0

I could grep for fixed-address in the dhcpd.conf file, associate that with the mac-address and the host identifier and then continually monitor the messages file … but it would be so much easier just to check the dhcpd.leases file.

Best Answer

I'm interested in the same thing.

I use OpenBSD at present, but am considering changing to FreeBSD.

My solution is to grab the information from the /var/log/daemon file. For my purposes, the exact lease time remaining is not as important as just knowing that they have recently renewed the lease. Therefore, I just assume an expiration time that is at least as long as the time assigned to the addresses.

Currently, I just parse the file when I need it. There is a way to have the syslog information go directly to a program that would process all new entries when received. You specify the action and the program in /etc/syslog.conf (on OpenBSD) with a "| monitor program".

My intention is to have the program retain the leases in memory and reply to requests for the information via a tcp connection.

One other thing. We don't get the description field from the log file. However, that can be gotten by cross referencing with the /etc/dhcpd.conf file for the fixed leases and /var/db/dhcpd.leases for the remaining leases.