[CentOS] DHCP static hosts and subnet configuration

Wed Oct 15 17:08:16 UTC 2008
Paul Heinlein <heinlein at madboa.com>

On Wed, 15 Oct 2008, Marcus Moeller wrote:

> Hi all.
>
> I have set up a DHCP server with multiple subnet configurations 
> (let's say subnet A and B). Within that I have declared pools and 
> static hosts addresses.
>
> Now, if I have set up a static host entry (with fixed-address) in 
> Subnet B for a specific machine and try to connect to Subnet A with 
> that NIC (where it should obtain an address from the range), this 
> does not work unless I add a static host entry for that machine to 
> the Subnet A declaration, too. I even have to assign a 
> fixed-address, there.
>
> I just want the NIC to clain it's address from the range on Subnet A 
> and to assign a fixed address on Subnet B.

You can assign multiple host blocks for the same NIC, using a 
fixed-address directive in one but not in other. dhcpd will try for 
the best match. If the request arrives from subnet-B, and the fixed 
address is on that net, then that's the block that gets used. 
Otherwise, the less specific block will be used. E.g.,

   host myhost {
     hardware ethernet 11:22:33:44:55:66;
     fixed-address myhost.mydom.com;
   }
   host myhost-roam {
     hardware ethernet 11:22:33:44:55:66;
   }

-- 
Paul Heinlein <> heinlein at madboa.com <> http://www.madboa.com/