classify by MAC address

Simon Hobson dhcp1 at thehobsons.co.uk
Fri Jan 20 12:47:14 UTC 2012


Ruzsinszky Attila wrote:

>class "KVM-vms" {
>    match if binary-to-ascii (16,8,":",substring(hardware, 0, 4)) = 
>"1:52:54:0";
>    log (debug, binary-to-ascii (16,8, ":", hardware));
>}



>        pool {
>            allow members of "KVM-vms";
>            range 192.168.52.180 192.168.52.199;
>            deny unknown-clients;
>            }



>        range 192.168.52.21 192.168.52.29;



>Of course it doesn't work.
>
>For Vbox+VMware VMs the system offer IPs from the general (range)
>pool.

It will do - or at least it can do.

You must explicitly deny those devices - permitting them elsewhere 
isn't enough. You need :

pool {
   range 192.168.52.21 192.168.52.29
   deny members of "KVM-vms";
   deny members of ...
   deny ...
}



Also, you can make operation slightly more efficient by just doing a 
string compare against the mac address. I believe you can change your 
statement to :

   match if substring(hardware, 0, 4)) = 1:52:54:0 ;

which means match the first 4 octets of hardware address to the 4 
octet string 1:52:54:0, rather than converting to ascii and comparing 
against the 9 character string "1:52:54:0".

-- 
Simon Hobson

Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed
author Gladys Hobson. Novels - poetry - short stories - ideal as
Christmas stocking fillers. Some available as e-books.



More information about the dhcp-users mailing list