[Dnsmasq-discuss] Vendor and User class compounds

Simon Kelley simon at thekelleys.org.uk
Thu Sep 28 15:59:16 BST 2006


Francois-Xavier Le Bail wrote:
>> Francois-Xavier Le Bail wrote:
> 
>>> Hi,
>>>
>>> I want to put some options for some hosts with the network-ids match
>>> system.
>>>
>>> These hosts are defined by such a test :
>>>
>>>     (vendor-class = "Vendor_1" and
>>>     (user-class = "device_1" or
>>>      user-class = "device_2" or
>>>      user-class = "...")
>>>     ) or (
>>>     vendor-class = "Vendor_2" and
>>>     (user-class = "device_A" or
>>>      user-class = "...")
>>>     ) or (
>>>     vendor-class = "Vendor_3" and
>>>     (user-class = "device_AA" or
>>>      user-class = "..."))
>>>     ...
>>>
>>> Have you an example of a dnsmasq.conf file for this case ?
>>>
>> You need to do this in two stages: first set network-ids based on the
>> vendor-class and user-class ids:
>>
>> dhcp-vendorclass = vendor1,"Vendor_1"  # sets tag vendor1
>> dhcp-vendorclass = vendor2,"Vendor_2"  # sets tag vendor2
>> # etc
>>
>> dhcp-userclass = user1,"device_1" # sets tag user1
>> #etc
>>
>> then you take advantage of the fact that dhcp-option lines can have more
>> than one tag, with an implied AND function. To get the OR function you
>> need to repeat the dhcp-option
>>
>> dhcp-option=vendor1,user1,56,....... # send option 56 to hosts which are
>>                                     # vendor1 and user1
>>
>> dhcp-option=vendor2,user2,56,....... # OR to hosts which are vendor2 and
>>                                     # user2
>> etc.
> 
> Thanks Simon,
> 
> We need another setup for these particular hosts.
> We want to use the same range, with --dhcp-range, for all these hosts.
> Is there a possible syntax AND/OR with this option ?
> 
> Francois
> 
> 

You can use the same trick: prefixing dhcp-range with
net:<tag>,net:<tag> will cause that ranger to be used only when the tags
are set; so something like:

dhcp-range=net:vendor1,net:user1,192.168.0.2,192.168.0.100

will do what you want.


HTH

Simon.




More information about the Dnsmasq-discuss mailing list