Dynamically assign Option to Clients:

Chris Buxton clists at buxtonfamily.us
Wed Nov 15 18:18:24 UTC 2017


Classes will work the way you think they should, with one exception. Client devices are mapped to classes before options values are set. Therefore, you won't be able to match on a hostname that you set in a host declaration, only on the hostname sent by the phone in its request.

It might be better to just match on MAC addresses, since that's effectively what you want to do anyway. Something like this (untested):

class "phones" {
  option ntp-servers ntp.mydomain.com;
  option tftp-server-name "https://tftp.mydomain.com";
  default-lease-time 600;
  max-lease-time 600;
  match hardware;
}

subclass "phones" 1:12:04:13:87:1c:41; # host phone132

Note that the hardware field is 7 octets long, including a leading 1 that is there for historical reasons.

Regards,
Chris

> On Nov 15, 2017, at 8:42 AM, MA2412 at gmx.de wrote:
> 
> Hello, i have a central dhcp server serving multiple remote networks. I want to assign the same group of options to Clients wo are on different Networks, based on MAC adress or better on hostnames. I tried to solve it over a "class" declaration, but it seams that classes are only woking in conjunction with "pools" or "subnets" or "ranges", a class declaration itself has no effect is this correkt?
>  
> For example i try:
>  
> class "phones" {
>   option ntp-servers ntp.mydomain.com;
>   option tftp-server-name "https://tftp.mydomain.com";
>   default-lease-time 600;
>   max-lease-time 600;
>   match host-name;
> }
>  
> host tel132 {
>    hardware ethernet 12:04:13:87:1c:41;
>    fixed-address 172.30.20.32;
>    option host-name "phone132";
> #Location: office
> }
> subclass "phones" "phone132";
>  
>  
> The phone should get a fixed IP adress and the options defined in the class.
> I also tried the following declaration:
>  
> class "phones" {
>   option ntp-servers ntp.mydomain.com;
>   option tftp-server-name "https://tftp.mydomain.com";
>   default-lease-time 600;
>   max-lease-time 600;
>   match if substring(option host-name,0,7) = "phone132";
> }
> host tel132 {
>    hardware ethernet 12:04:13:87:1c:41;
>    fixed-address 172.30.20.32;
>    option host-name "phone132";
> #Location: office
> }
>  
> Should have the same effect, but also des not work, as expected above, i thind class declaration does not work if not assigned to a pool or subnet or range.
>  
> Can a client be assigned to multiple classes, is this possible or can a client only be member of one class?
>  
> Thanks for your help!!
> _______________________________________________
> dhcp-users mailing list
> dhcp-users at lists.isc.org
> https://lists.isc.org/mailman/listinfo/dhcp-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/dhcp-users/attachments/20171115/ca2c15f7/attachment.html>


More information about the dhcp-users mailing list