首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为特定的MAC前缀分配DHCP IP

为特定的MAC前缀分配DHCP IP
EN

Server Fault用户
提问于 2009-10-30 00:55:20
回答 2查看 22.7K关注 0票数 9

我正在为我的网络运行一个ISC DHCPd服务器,为许多子网服务。我想要做的事情之一是为具有通用MAC前缀的主机分配特定范围的IP(例如。00:01:02)。此外,这些任务必须能够被固定地址的任务覆盖.我已经在谷歌上搜索过了,但还没有找到任何确定的信息。

如果我能把这个声明放在我的dhcpd.conf的子网中(它会更适合我的管理软件),那就更好了。

EN

回答 2

Server Fault用户

回答已采纳

发布于 2009-10-30 19:53:52

在我的系统(debian )上,我需要二进制到ascii才能匹配mac地址。在我的dhcpd.conf中的这个(工作)示例中,server247在类"local“中,但是,我给它一个固定的地址,而它不在池中。我建议将固定地址与动态分配的地址分开(它们仍然可以位于同一个子网中)。

代码语言:javascript
复制
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;
  }
}

以你为例,你会做:

代码语言:javascript
复制
match if binary-to-ascii(16,8,":",substring(hardware, 1, 3)) = "00:01:02";
票数 10
EN

Server Fault用户

发布于 2009-10-30 05:59:14

就像这样:

代码语言:javascript
复制
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),试一试。:)

票数 15
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/79748

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档