1

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.

  • 2
    It knows about the static IP outside of the pool because of your subnet declaration that defines the prefix size. – tlund Apr 6 '16 at 22:35
  • Is it expected behavior then that these make no entries into the dhcpd.leases file? Whats a good way to track these exceptions in terms of "whats connected" if thats the case? – user53029 Apr 6 '16 at 22:49
  • to keep track of static IPs outside of the DHCP server's influence ensure that your DNS server is updated properly. – BeowulfNode42 Apr 7 '16 at 3:13
3

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.

2

Some DHCP server software operate differently when it comes to reservations:

  • some require that all reserved addresses be outside the dynamic range but be within the subnet.
  • some require that all reserved addresses be within the dynamic range, and it then knows not to use these when allocating other hosts dynamically.
  • some allow a reserved address to be inside or outside the dynamic range.

Reading the man pages for the most common Linux DHCPd it seems it allows for any of the above policies to be in place through the use of the pool option combinations:

  • allow known-clients;
  • deny known-clients;
  • allow unknown-clients;
  • deny unknown-clients;

The definition of a known client is one that has a host entry somewhere in the conf file. So if you do not "allow known-clients;" in a pool you cannot allocate a fixed-address inside the range the pool uses.

Of course for the reserved fixed address, dynamic address, and statically assigned IPs to all talk to each other they either need to be in the same subnet on the same LAN or have the required routing between their subnets.

You can do both, reserve an IP in the DHCPd and set a static IP on the actual host. It simply means that the DHCP server is never asked which IP to use, the host simply uses it. Doing this can assist with self documentation of the use of IP addresses as it can provide a fairly central storage area for what IP all devices have. Though like any documentation technique it needs to be maintained or it is useless. Instead of documenting host-IP in the DHCPd server you could also use the DNS server, or you could have separate documentation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.