0

I'm running ISC DHCPd on Raspbian. I want to set up my server so that all addresses in 192.168.0.0/24 are static leases, and all in 192.168.1.0/24 are dynamic leases. I'd like the two to share the 192.168.0.0/23 subnet.

Clarification: Basically, I want a single DHCP server to handle DHCP for the entire 192.168.0.0/23 subnet. If a device that requests an IP has a host entry defined in dhcpd.conf, it will assign it the IP address that is specified. If it does not, it will assign an address in the range 192.168.1.2 - 192.168.1.254. For simplicity, I have limited all of my static leases to reside in the range 192.168.0.2 - 192.168.0.254.

I have my server configured as so:

option domain-name "home";
option domain-name-servers 192.168.0.3;
default-lease-time 600;
max-lease-time 7200;
ddns-update-style none;
authoritative;
host mightyturing{ hardware ethernet 10:bf:48:87:74:a2; fixed-address 192.168.0.64; }
host beastnugget{ hardware ethernet 34:e6:d7:52:1e:e4; fixed-address 192.168.0.65; }
host ... (about 50 more static leases)
subnet 192.168.1.0 netmask 255.255.255.0 {
        option routers 192.168.0.1;
        option broadcast-address 192.168.1.255;
        option domain-name-servers 192.168.0.3, 1.1.1.1;
        option domain-name "home";
        option subnet-mask 255.255.254.0;
        ddns-updates off;
}

When I try to start the service it whines:

Nov 17 17:45:26 raspberrypi dhcpd[681]: DHCPREQUEST for 192.168.0.64 from 10:bf:48:87:74:a2 via eth0
Nov 17 17:45:26 raspberrypi dhcpd[681]: DHCPACK on 192.168.0.64 to 10:bf:48:87:74:a2 via eth0
Nov 17 17:45:59 raspberrypi dhcpd[681]: Dynamic and static leases present for 192.168.0.64.
Nov 17 17:45:59 raspberrypi dhcpd[681]: Remove host declaration mightyturing or remove 192.168.0.64
Nov 17 17:45:59 raspberrypi dhcpd[681]: from the dynamic address pool for 192.168.0.0/23

... and since my lease pool is 192.168.1.0/24... I'm pretty sure that means that 192.168.0.64 is not in the pool. So why is ISC not recognizing this? Why is it complaining about a range that I have not instructed it to issue dynamic IPs for?

Also:

When I change the range to issue dynamic IPs on the 10.0.0.0/24 range (to test ISC's sanity), but keep the static leases in 192.168.0.0/24, it still complains about 192.168.0.0/23 so what is going on? Where, precisely, did I ask it to hand out 192.168.0.0/23 addresses?

option domain-name "home";
option domain-name-servers 192.168.0.3;
default-lease-time 600;
max-lease-time 7200;
ddns-update-style none;
authoritative;
host mightyturing{ hardware ethernet 10:bf:48:87:74:a2; fixed-address 192.168.0.64; }
host beastnugget{ hardware ethernet 34:e6:d7:52:1e:e4; fixed-address 192.168.0.65; }
subnet 10.0.0.0 netmask 255.255.255.254 {
        option routers 10.0.0.1;
        option broadcast-address 10.0.0.255;
        option domain-name-servers 1.1.1.1;
        option domain-name "home";
        option subnet-mask 255.255.255.0;
        ddns-updates off;
}
  • 1
    Not sure if it is a typo, but you write to have 192.168.0.0/24 and 192.168.1.0/24 networks, but from the config and log files they are /23 and are overlapping. You might want to add the output of ip route of your dhcp server. – Thomas Nov 17 '18 at 18:10
  • I want traffic to cross between them, but I want to segregate based on lease type. Hand out static leases on 192.168.0.0/24 and dynamic leases on 192.168.1.0/24 but have them share the 192.168.0.0/23 subnet for routing. Is that not how I have it set up? – Chris Nov 17 '18 at 18:12
  • 1
    Nope, this is not how IP networks work. You have to separate the networks so they do not overlap. Then set up routing between those two subnets. – Thomas Nov 17 '18 at 18:14
  • Ok, so if I wanted to reserve part of the 192.168.0.0/24 subnet (say, 192.168.0.16-192.168.0.31) for only static leases and use the rest for dynamic leases, could I do that? – Chris Nov 17 '18 at 18:17
  • Sure, just use range 192.168.0.16 192.168.0.31; in your subnet declaration to limit the dynamic leases, configure your other hosts with the host ... directive and be sure to leave out any other IP addresses that are assigned statically like the IP address of the DHCP server itself. – Thomas Nov 17 '18 at 18:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.