Tuesday, September 19, 2017

Isc-dhcpd leases file problem and solution

Hello ports. I suddenly remarked a problem with medium loaded isc-dhcpd on my server.

The problem looked like this string in messages:

Sep 18 11:59:37 helios dhcpd: Can't create new lease file: Permission denied

So I looked in /var/db and that's what I saw:

$ ls -alh /var/db/dhcpd.leases*
-rw-r--r-- 1 _isc-dhcp _isc-dhcp 179M Sep 19 14:50 /var/db/dhcpd.leases
-rw-r--r-- 1 _isc-dhcp _isc-dhcp 59.5M Jul 4 15:40 /var/db/dhcpd.leases~

Seriously? On the net with 200 hosts?

I just created dhcpd directory near this files and moved them into it, changed the owner to _isc_dhcp and restarted with flags:

isc_dhcpd_flags="-user _isc-dhcp -group _isc-dhcp -lf /var/db/dhcpd/dhcpd.leases"

After restarting files became dramatically thinner:

$ ls -alh /var/db/dhcpd
total 620
drwxr-xr-x 2 _isc-dhcp _isc-dhcp 512B Sep 19 15:10 .
drwxr-xr-x 9 root wheel 512B Sep 19 14:43 ..
-rw-r--r-- 1 _isc-dhcp _isc-dhcp 136K Sep 19 15:10 dhcpd.leases
-rw-r--r-- 1 _isc-dhcp _isc-dhcp 168K Sep 19 15:10 dhcpd.leases~

Maybe it's better to use it that way?

No comments:

Post a Comment