0

In Windows' DHCP server it is possible to exclude an entire subnet from being given out to clients which doesn't have a reservation. They call this "IP addresses excluded from distribution".

Now I would like to do the same on Linux' DHCPD. So I have these subnets

# servers
subnet 192.168.91.0 netmask 255.255.255.0 {
  range 192.168.91.2 192.168.91.254;
  option routers 192.168.91.1;
}

# desktop computers
subnet 192.168.234.0 netmask 255.255.255.0 {
  range 192.168.234.2 192.168.234.254;
  option routers 192.168.234.1;
}

where the users desktops should never be given an IP from the "servers" range. Only hosts that have a reservation should be able to get one from the "servers" range. But anyone are allowed to get an IP from the "desktops" range.

Question

How can I do that in Linux' DHCPD?

Sandra
  • 9,973
  • 37
  • 104
  • 160

1 Answers1

2

Simple - don't add a range.

# servers
subnet 192.168.91.0 netmask 255.255.255.0 {
  option routers 192.168.91.1;
}

And then later in your config, you can give out specific IPs in that subnet to specific MAC addresses as needed.

Here's an example from my actual DHCP server (sorry, at home on my Pi, not in a "professional environment" but all the same anyway... just a matter of scale)

$ cat /etc/dhcp/dhcpd.conf
default-lease-time 600;
max-lease-time 700;
ddns-update-style none;
authoritative;
log-facility local7;
lease-file-name "/etc/dhcp/leases.dhcpd";

option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
option ms-classless-routes code 249 = array of unsigned integer 8;

#notice no range in this subnet
subnet 192.168.1.0 netmask 255.255.255.0 {
  option domain-name "home.test";
  option domain-name-servers 192.168.1.2;
  option routers 192.168.1.1;
  option rfc3442-classless-static-routes 24, 10,99,97, 192,168,1,2;
  option ms-classless-routes 24, 10,99,97, 192,168,1,2;
}

subnet 10.99.97.0 netmask 255.255.255.0 {
  range 10.99.97.150 10.99.97.175;
  option domain-name "home.test";
  option domain-name-servers 192.168.1.2;
  option routers 10.99.97.2;
}

host webdev{
 hardware ethernet 08:00:27:74:07:21;
 fixed-address 192.168.1.90;
}
ivanivan
  • 1,448
  • 6
  • 6