Dynamically assign Option to Clients:

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Dynamically assign Option to Clients:

MA2412
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
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

RE: Dynamically assign Option to Clients:

Patrick Trapp

I am far from an expert here, but we are successfully using class statements. It appears that you may be using the class statement to do too much. We only use the class statement to identify what devices qualify for the class. Then in the pool, we use allow statements to determine what classes of device qualify. We are using option-82 information to determine what class the device belongs in, as shown below.

 

class “end-point-device”

{       match if

        (

                (substring (option agent.circuit-id, 0, 4) = "PREF")

                and not

                (suffix (option agent.circuit-id, 5) = "SUFFI")

        );

}

class "residential-gateway"

{       match if

        (

                (substring (option agent.circuit-id, 0, 4) = "PREF")

                and

                (suffix (option agent.circuit-id, 5) = "SUFFI")

        );

}

 

How much variation will you have for the options you are trying to declare in the class block?

From: dhcp-users [mailto:[hidden email]] On Behalf Of [hidden email]
Sent: Wednesday, November 15, 2017 10:42 AM
To: [hidden email]
Subject: Dynamically assign Option to Clients:

 

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
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: Dynamically assign Option to Clients:

Chris Buxton
In reply to this post by MA2412
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, [hidden email] 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
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users


_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: Dynamically assign Option to Clients:

Bill Shirley-2
I think Chris is right about the classes being mapped first.

Try a group:
group {
  option ntp-servers ntp.mydomain.com;
  option tftp-server-name "https://tftp.mydomain.com"'
  default-lease-time 600;
  max-lease-time 600;

  host tel132 {
    hardware ethernet 12:04:13:87:1c:41;
    fixed-address 172.30.20.32;
    option host-name "phone132";
  }
  host tel133 {
    hardware ethernet 12:04:13:87:1c:42;
    fixed-address 172.30.20.33;
    option host-name "phone133";
  }
}


Bill

On 11/15/2017 1:18 PM, Chris Buxton wrote:
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, [hidden email] 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
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users



_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users


_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: Dynamically assign Option to Clients:

Simon Hobson
In reply to this post by Chris Buxton
Chris Buxton <[hidden email]> wrote:

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

Being pedantic, it's not there for historical reasons, the 1 is the hardware type (ethernet). Other values exist for other network types (eg token ring) which may also have different hardware identifier lengths.

_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users