Client Classing/Sub-Classing

Simon Hobson dhcp1 at thehobsons.co.uk
Thu Feb 21 22:20:31 UTC 2008


Kelvin Williams wrote:

>I am trying to create a class on in my configuration based on the 
>hardware address of the device.
>
>I have a list of OUIs from the manufacturer.
>
>Could someone give me an example of how I would create a class 
>called: "widgets"  Where the first 8 characters of the hardware MAC 
>would be:
>
>12:34:56
>34:56:78
>56:78:90
>
>Thanks in advance.

May I suggest you try looking at a list before leaping in with a 
question ? This question is answered by a thread from oooh so long 
ago - like yesterday - under the subject "Need help setting up a 
scope using the oui of network cards" !


But to answer the question again, simply match on the first four 
bytes of "hardware", as in (copying the message I posted YESTERDAY) :


>Try 'man dhcpd.conf', look for the section on classes and 
>subclasses. That deals with setting up of classes (and subclasses) 
>but based on MAC address.
>
>Now, 'man dhcpd-eval' will tell you how to get a substring.
>
>So what you will end up with, in it simplest form, is something like :
>
>class "some-vendor" {
>   match if substring(hardware,0,4)=1:aa:bb:cc);
>}
>
>
>...
>
>subnet ....
>   pool {
>     allow members of "some-vendor" ;
>     ....
>   }
>}
>
>You'll have to check the syntax for that lot.
>
>
>You can also do subclasses in much the same way, simply replace 
>"hardware" in the example with "substring(hardware,0,4)" - and 
>probably drop the "pick first value" stuff.
>
>So you'd end up with :
>
>        class "allocation-class-1" {
>          match substring(hardware,0,4);
>        }
>
>        subclass "allocation-class-1" 1:8:0:2b;
>        subclass "allocation-class-1" 1:0:0:c4;


Note that I said FOUR bytes ? Yes, what you are asking to match is 
NOT eight characters, it's THREE bytes - and the whole thing is 
preceded by a '1' to indicate ethernet hardware.



More information about the dhcp-users mailing list