DHCP "static" assignments

Rob Riepel riepel at networking.stanford.edu
Wed Aug 7 21:52:27 UTC 2013


On Aug 7, 2013, at 2:12 PM, Gregory Sloop wrote:

> CB> On Aug 7, 2013, at 1:39 PM, Gregory Sloop <gregs at sloop.net> wrote:
> 
>>> Here's the effect I want...
>>> 
>>> I want the DHCP server to hand out specific IP's to specific MAC
>>> addresses, [as defined in the host record.]
>>> 
>>> They're static DHCP assignments, not static IP clients.
>>> ---
>>> i.e. I want 10.0.0.10 to get assigned *via the DHCP server* to the
>>> host with MAC Address aa:bb:cc:dd:ee:ff
>>> 
>>> Also, I'm assigning via DHCP addresses from 10.0.0.1-10.0.0.20 to
>>> anyone who asks via DHCP.
>>> 
>>> The way I do it now, is assign pools as follows
>>> 
>>> 10.0.0.1-10.0.0.9 && set "allow unknown-hosts"
>>> 10.0.0.10 && set "deny unknown-hosts"
>>> 10.0.0.11-10.0.0.20 && set "allow unknown-hosts"
>>> 
>>> AND create a host entry for 10.0.0.10 like so:
>>> 
>>> host somehost {
>>>       hardware ethernet aa:bb:cc:dd:ee:ff;
>>>       fixed-address 10.0.0.10;
>>>       }
>>> 
>>> I *think* I have to include the relevant IP in a pool. (In this case
>>> 10.0.0.10)  [If there's no pool with 10.0.0.10 in it, the DHCP server
>>> won't hand out an IP for 10.0.0.10, no matter what host record there
>>> is, will it?]
> 
> CB> Yes it will. You do not need a pool surrounding your reserved address.
> 
> CB> Something like this should work:
> 
> CB> host somehost {
> CB>         hardware ethernet aa:bb:cc:dd:ee:ff;
> CB>         fixed-address 10.0.0.10;
> CB> }
> 
> CB> subnet 10.0.0.0 netmask 255.255.255.0 {
> CB>         <options>
> CB>         pool {
> CB>                 range 10.0.0.1 10.0.0.9;
> CB>                 range 10.0.0.11 10.0.0.20;
> CB>         }
> CB> }
> 
> Wow, I guess I really *was* holding it wrong, eh!? :)
> Thanks all for the help!
> 
> [I still wish I could just define the whole pool as 1-20 and then the
> host def would reserve it, but I'll live, I suppose. :) ]

This wish, or its intent, has been expressed many times on this list.  The answer is always to use reserved leases.  But there's no way to reserve a lease using the configuration file.  It can only be done dynamically omshell/omapi (as mentioned in your original message) or by hacking the leases file.  It might be nice if in addition to:

    host somehost {
        hardware ethernet aa:bb:cc:dd:ee:ff;
        fixed-address 10.0.0.10;
    }

the DHCP configuration would accept something like:

    host somehost {
        hardware ethernet aa:bb:cc:dd:ee:ff;
        reserve-address 10.0.0.10;
    }

to create a reserved lease.  But I suspect it would have been added by now if it were possible without a whole lot of changes to the way dhcpd processes the configuration file.

--
Rob Riepel




More information about the dhcp-users mailing list