为特定的MAC前缀分配DHCP IP

我正在为我的networking运行一个ISC DHCPd服务器,为多个子网提供服务。 我想要做的一件事就是为具有普通MAC前缀(例如00:01:02)的主机分配一个特定范围的IP。 另外,作业必须能够被具有固定地址的作业所覆盖。 我一直在search,但没有发现任何明确的。

如果我可以把这个声明放在我的dhcpd.conf的子网节里面(这对我的pipe理软件来说更合适)。

在我的系统(debian lenny),我需要二进制到ASCII码匹配MAC地址。 在我的dhcpd.conf的这个(工作)的例子中,server247在类“local”中,但是,我给它一个固定的地址,它不在池中。 我build议固定地址与dynamic分配的地址分开(它们仍然可以在同一个子网中)。

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; } } 

举个例子,你可以这样做:

 match if binary-to-ascii(16,8,":",substring(hardware, 1, 3)) = "00:01:02"; 

像这样的东西:

 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"; } } 

嗯,它应该是(硬件,0,2)或(.. 1,3),testing出来。 🙂