Assign DHCP IPs for specific MAC prefixes
On my system (debian lenny), I need to need binary-to-ascii in order to match mac-addresses. In this (working) example from my dhcpd.conf, server247 is in class "local", however, I give it a fixed address that it not in the pool. I would recommend that the fixed addresses be in a separate range from the dynamically assigned addresses (they can still be in the same subnet).
class "kvm" {
match if binary-to-ascii(16,8,":",substring(hardware, 1, 2)) = "56:11";
}
class "local" {
match if binary-to-ascii(16,8,":",substring(hardware, 1, 2)) = "52:54";
}
host meme {
fixed-address 10.1.0.254;
}
host server247 {
hardware ethernet 52:54:00:2f:ea:07;
fixed-address 10.1.0.247;
}
subnet 10.1.0.224 netmask 255.255.255.224 {
option routers 10.1.0.225;
pool {
allow members of "kvm";
range 10.1.0.226 10.1.0.235;
}
pool {
allow members of "local";
range 10.1.0.236 10.1.0.240;
}
pool {
# Don't use this pool. It is really just a range to reserve
# for fixed addresses defined per host, above.
allow known-clients;
range 10.1.0.241 10.1.0.253;
}
}
For your example, you would do:
match if binary-to-ascii(16,8,":",substring(hardware, 1, 3)) = "00:01:02";
Something like this:
class "specialK" {
match if substring (hardware, 1, 3) = 00:01:02;
}
subnet 10.0.0.0 netmask 255.255.255.0 {
pool {
range 10.0.0.16 10.0.0.32;
allow members of "specialK";
}
}
hmm, is it supposed to be (hardware, 0, 2) or (.. 1, 3), test it out. :)