classify by MAC address

Ruzsinszky Attila ruzsinszky.attila at gmail.com
Fri Jan 20 12:27:18 UTC 2012


Hi,

I've got a subnet.
I want 4 pools in it:
- for KVM
- for VBox
- for VMware clients
- other clients.

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));
}

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

class "VMware-vms" {
   match if binary-to-ascii (16,8,":",substring(hardware, 0, 4)) = "1:0:c:29";
   log (debug, binary-to-ascii (16,8, ":", hardware));
}

subnet 192.168.52.0 netmask 255.255.255.0 {
#class "not-KVM-vms" {
#    match if not(binary-to-ascii (16,8,":",substring(hardware, 0, 4)) = "1:52:5
#    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;
           }
       pool {
           allow members of "VBox-vms";
           range 192.168.52.170 192.168.52.179;
           deny unknown-clients;
           }
       pool {
           allow members of "VMware-vms";
           range 192.168.52.160 192.168.52.169;
           deny unknown-clients;
           }
       range 192.168.52.21 192.168.52.29;
       option subnet-mask 255.255.255.0;
       option broadcast-address 192.168.52.255;
       option routers 192.168.52.254, 192.168.52.7;
       option netbios-name-servers 192.168.52.5;
       option domain-name-servers 192.168.52.6, 192.168.7.2;

       option ntp-servers 192.168.4.2;
       if exists user-class and option user-class = "iPXE" {
           filename "http://freenas..hu:9080/tinycore.ipxe";
           option root-path "iscsi:192.168.52.60::::iqn.2010-12.hu.
           } else {
           filename "undionly.kpxe";
           }
}

Of course it doesn't work.

For Vbox+VMware VMs the system offer IPs from the general (range)
pool. I don't know why. I've got no ideas. I used Google without any
good examples.

TIA,
Ruzsi



More information about the dhcp-users mailing list