Sending DHCP IP based on clients hostname

I’m working on a project where I need my DHCP server to send an IP address from a specific DHCP range if the hostname is a certain value otherwise it needs to send a normal IP address range.

I’m using Internet Systems Consortium DHCP Server V3.0.3 (ISC-DHCP).

To give a specific address range, we first need to detect if the DHCP client is sending the option 12 host-name and if so assign it to a class.

class “FooBar” { match if (option host-name = “foobar”); }

Once the client has a class associated to it we need to give it an address from a pool that doesn’t deny it.

subnet netmask {

Other DHCP settings here but make sure that the range is not specified; it overrides the pool settings.

pool {
allow members of “FooBar”;

Otherwise we want the systems that don’t specify a hostname to get an address from the normal IP address pool

pool {

Add more pools if needed

} # ending the subnet declaration

Pretty simple, hu?


Thanks to a post I read by Bill Stephens of the PepsiCo Business Solutions Group, you can match a hostname using substr.  If your DHCP clients are named foobar-xyz you can use substr to match for foobar:

class “FooBar” {

match if ( substring(option host-name,0,6) = “foobar”);


(This would match the first 6 characters of the option 12 host-name)

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>





This site uses Akismet to reduce spam. Learn how your comment data is processed.