1

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.

2
  • what's the question? May 18, 2015 at 8:59
  • I added the question to make it more clear. Thanks.
    – m1r0
    May 18, 2015 at 9:34

1 Answer 1

1

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.

5
  • Thanks for the suggestion. Is there a way to avoid changing the range and force the DHCP server to check the fixed addresses before given a dynamic one?
    – m1r0
    May 18, 2015 at 9:38
  • According to bctes.com/dhcpd.conf.5.html DHCP sends an ICMP to check if the IP is actually available before allocating ("If no ICMP Echo reply is received within a second, the address is assumed to be free"). Do you have ICMP blocked on the targets that have static IPs? May 18, 2015 at 10:02
  • The ICMP is not blocked, but some PCs are turned off once in a while... Maybe that's the problem?
    – m1r0
    May 18, 2015 at 11:18
  • It doesn't consult your list of static IPs to check if it's available, it just tries to ping it (as you have defined it in the range of available DHCP addresses it can give out). I would strongly suggest segregating your known static IPs from the dhcp range to avoid this. That's how we do it with dnsmasq, the ranges don't overlap so there's no chance of conflict. May 18, 2015 at 11:29
  • Using ICMP packets for that purpose only makes sense if the DHCP requests are being relayed to a DHCP server on a different network segment. If the DHCP server is on the same segment as the clients, using just an ARP packet would be sufficient. Additionally the client can send an ARP packet to verify if the address is in use. In case of a conflict, the client can tell the DHCP server that the address is in use and request a different one.
    – kasperd
    May 18, 2015 at 12:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .