DHCP with fixed IP hosts (Ubuntu)

dhcpdhcp-serverdhcpd

I'm managing an office system that assigns IPs based on the MAC address. The fixed hosts are added in a dhcpd-hosts.conf file which is included in dhcpd.conf. There are some PCs that are not in the system and they get dynamic IPs. Most of the PCs are configured to use DHCP. Some servers are with static IPs and they are not included in the dhcpd-hosts.conf file.

The problem is that the dynamically assigned IPs, sometimes are in conflict with the fixed ones.

So the question is how do i stop the conflict?

Here is the dhcpd.conf:

ddns-update-style none;
default-lease-time 86400;
max-lease-time 604800;
authoritative;
deny declines;
ping-check true;

subnet 192.168.2.0 netmask 255.255.255.0 {
  option subnet-mask 255.255.255.0;
  option broadcast-address 192.168.2.255;
  option routers 192.168.2.1;
  option domain-name-servers 192.168.2.1;
  range 192.168.2.2 192.168.2.254;
}

include "/etc/dhcp/dhcpd-hosts.conf";

The dhcpd-hosts.conf file includes many host entries, for example:

host pcname {
  hardware ethernet 00:25:22:ac:0c:44;
  fixed-address pcname.int;
}

The pcname.int is an internal domain which is resolved to an IP (192.168.2.123) by the DNS.

Best Answer

Assuming your question is, "how do i stop the conflict?", simply up the start IP of the range, and put the static IPs below this, i.e.

range 192.168.2.20 192.168.2.254;

and then 192.168.2.1 -> 192.168.2.19 are free for statics.

Obviously, you'll have to adjust your statics to fit this partitioning.

EDIT:

After RTFM'ing a bit, according to dhcpd manuals under "Ip Address Conflict Prevention", the server should send ICMP messages to determine if the IP is in use first, so if that's blocked or there's a timing issue, it will believe the IP is free.