大网数据广告活动
服务器运维问答

how dhcpd handles static IPs vs DHCP reservations

· 52CE 我爱测

We have a RHEL 6.7 server for DHCP. I am needing some clarification on how dhcpd handles network addressing when someone wants a permanent IP address. Here is a sample config from one of our servers. My understanding is there are…

问题原文

原帖链接 · user53029 · CC BY-SA 3.0

We have a RHEL 6.7 server for DHCP. I am needing some clarification on how dhcpd handles network addressing when someone wants a permanent IP address. Here is a sample config from one of our servers. My understanding is there are 2 ways to get them. A DHCP reservation and a true static IP which falls outside the DHCP scope.

subnet 192.168.100.0 netmask 255.255.255.0 {
  option domain-name "domain.net";
  option broadcast-address 192.168.100.255;
  option routers 192.168.100.1;

  # Define the scopes for this DHCP pool

  pool {
   range 192.168.100.2 192.168.100.200;
   # static reserve = 192.168.100.201 - 192.168.100.254
  }
  host static-custid {
   hardware ethernet 00:01:02:03:04:05;
   fixed-address 192.168.100.150;
  }
  host static-custid {
   hardware ethernet 00:01:02:03:04:05;
   fixed address 192.168.100.201;
  }
}

So as you can see, we have one static reserve outside the DHCP scope and one inside. My understanding is that dhcpd only knows about the one inside a declared pool since the client will be using the DHCP protocol. But for the life of me I can't get anyone here to explain to me why we are declaring static reserves for IP's not defined in a pool. Is it possible that dhcpd would know about the static reserve outside the pool and give it the 192.168.100.201 when it sees that mac address AND the client is using DHCP? I don't think this is the case because all of these static reserves that fall outside the pool are not in the dhcpd.leases file.

已采纳解答

原帖链接 · BillThor · CC BY-SA 3.0

Static IPs are normally outside the pool range as you do not want static IPs assigned to other hosts. As long as the static IPs are in an IP range local (or relayed) to the DCHP server they can be served.

The leases file records which addresses from the pool have been assigned to a host and when that assignment expires. This is used to ensure that multiple hosts don't get assigned the same IP address. The presence of an active lease does not indicate that host is currently connected to the network. As static IP assignments are know by their definition, they do not need to be recorded in the lease file.

If the lease time is too long and clients frequently change, it is possible to run out of addresses while only a few hosts are currently connected. This is more likely in a hot-spot or guest network than a typical office network.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-04-06)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。