0

We have DHCP setup to hand out leases in the following range:

192.168.10.190 - 192.168.10.254 (roughly 65 leases)

Our small business network only has about 30 computers that use DHCP. We noticed that dhcpd stopped handing out new dynamic leases to the computers, even though there are definitely not 65 computers on the network.

Why has it stopped handing out leases? Is it not releasing old un-used leases? How do we tell dhcpd to let go of old leases and start handing out fresh ones again?

Jake Wilson
  • 8,814
  • 29
  • 97
  • 125
  • I'm curious what the dhcp traffic looked like when a request for a new lease came in. The reason I'm curious is that on paper, in a pinch dhcpd will reuse addresses in the pool -- the protocol even has dhcpd attempt to ping the IP addresses it is considering giving, out to ensure it is unused. – kiko Feb 03 '16 at 01:31

4 Answers4

2

The right option here is to use the one-lease-per-client option. Example:

#
# Sample configuration file for ISC dhcpd for Debian
#
# $Id: dhcpd.conf,v 1.1.1.1 2002/05/21 00:07:44 peloy Exp $
#
ddns-update-style none;
option domain-name "example.net";
option domain-name-servers 1.1.1.1, 2.2.2.2;
option ntp-servers ntp.example.net;

default-lease-time 3600;
max-lease-time 7200;

authoritative;
log-facility local7;
deny declines;
deny duplicates;
one-lease-per-client true;

default-lease-time and max-lease-time have nothing to do with max lease entries(only expiration time of that lease generated at that time). deny duplicates will also enforce that you can't have duplicated lease entries for the same mac but different client identification(a host with dual boot, will probably fail if you boot the secondary OS when still having a valid lease on your primary OS). deny declines will make DHCPDECLINE requests comming from clients to be ignored.

1

It depends on many things, the biggest being the lease time. If you give out a very large lease time, dhcpd may stop giving out new ones until some expire.

Checking the log (syslog) will likely give you a direct clue on what is going on.

To "fix" this is tricky. You can stop the dhcpd process and edit the lease file directly. This is risky if you are uncertain what you are doing. There may be tools to handle this for you, or tools to list the contents at least.

Michael Graff
  • 6,668
  • 1
  • 24
  • 36
1

Normally, lease expiration time should have nothing to do here, as long as clients are correctly sending DHCPRELEASE packet, at the end of DHCP client-server communication. Also, check-ping statement in dhcpd.conf should help solve the problem or at least show the source. According to my experience, problems with leases can come from buggy clients - process is following:

  1. Client starts with DHCPDISCOVER
  2. Server reserves IP and reply with DHCPOFFER
  3. Client ignore packet or never receive it and starts conversation again. If this happen quickly, such buggy client can borrow all the leases easily. Search for such client observing conversation in logs and by grep -i ff:ff:ff $PATH_TO_DHCPD_LEASES_FILE On the other hand, remember that in dhcpd.leases file there are also expired leases. So it can looks like all leases are used, but it is not the case. You should easily parse this file with awk and grep (or perl), to see how many is in use.

Also - you can blank lease file and restart the server. This can help you to see how the process looks like. But be aware that if you have no manual dhcp clients (IP assigned depending on MAC), IP addresses provided for workstations could and probably will change.

plluksie
  • 468
  • 3
  • 10
0

Check your default-lease-time and max-lease-time settings in /etc/dhcpd3/dhcpd.conf

If the lease expiration setting is extremely high it may be retaining very old leases. If that's the problem reducing the lease expiration time should release leases which are older than the new lease expiration time.

caleban
  • 1,116
  • 5
  • 18
  • 34