Class matching based on client host name

Simon Hobson dhcp1 at thehobsons.co.uk
Thu May 15 14:49:59 UTC 2008


Mcwilliams, Rhys \(ADP DSI\) wrote:

>Scenario: I have 2 branches each with its own default gateway, DNS 
>servers etc... (lets call then "br1" & "br2")
>The Windows machine names are all prefixed with the branch name 
>(e.g. br1-john or br2-peter). The users regularly travel between the 
>branches.
>The dhcpd.conf will specify a "fixed-address" for each client of 
>their specific branch based on MAC (this is all up and running 
>already).
>
>What I'm trying to achieve is a class match based on the first 4 
>characters of the users Windows machine name
>something like the following
># branch 2 DHCP server
>       class "br1-clients" {
>                 match if (
>                   (substring(option host-name,0,4) = "br1-") or
>                   (substring(option host-name,0,4) = "BR1-"));
>         }
>
># branch 1 DHCP server
>       class "br2-clients" {
>                 match if (
>                   (substring(option host-name,0,4) = "br2-") or
>                   (substring(option host-name,0,4) = "BR2-"));
>         }
>
>Then I need a pool on each to assign from based on the class
>something like the following
># branch 2 DHCP server (plus all the other usual options like 
>"option routers" etc local to each site)
>      pool {
>                         allow members of "br1-clients";
>                         allow known-clients;
>                         max-lease-time 86400;
>                         default-lease-time 43200;
>                         range 10.10.10.1 10.10.10.61;
>      }
>
># branch 1 DHCP server (plus all the other usual options like 
>"option routers" etc local to each site)
>      pool {
>                         allow members of "br2-clients";
>                         allow known-clients;
>                         max-lease-time 86400;
>                         default-lease-time 43200;
>                         range 10.10.11.1 10.10.11.61;
>      }
>
>So what should happen then is that if a user from br1 visits br2 - 
>the machine name starts with "br1-" and is therefore assigned an IP 
>out of the 10.10.10 pool.
>
>There seems to be a problem with this attempted config as my test 
>machines are not getting assigned IP's from the pool - it doesn't 
>even show anything in the log file while one of the machines is 
>trying for an IP. I'm guessing that my problem lies with the 
>"(substring(option host-name,0,4) = "br1-")". I'm using that because 
>I found such an example on the net (it didn't stat whether it work 
>though...) and I can't find any other option...

You haven't posted the whole config file, so we have to guess at what 
else you have included or omitted !

Do you have separate subnets (ie 10.10.10.0/24 & 10.10.11.0/24), one 
larger one (eg 10.10.10.0/23), or soemthing totally different ?

If you have separate subnets, have you included them in a 
shared-subnet declaration ?

Is anything at all logged ?


More information about the dhcp-users mailing list