[Dnsmasq-discuss] Using Vendor Class to determine range

richardvoigt at gmail.com richardvoigt at gmail.com
Fri Mar 4 17:02:01 GMT 2011


This probably should have gone to the list.

On Fri, Mar 4, 2011 at 11:01 AM, richardvoigt at gmail.com <
richardvoigt at gmail.com> wrote:

> Simon's latest version is 2.57, you want at least 2.53, a snippet from the
> changelog:
>
> version 2.53
> 	    Rationalised the DHCP tag system. Every configuration item
> 	    which can set a tag does so by adding "set:<tag>" and
> 	    every configuration item which is conditional on a tag is
> 	    made so by "tag:<tag>". The NOT operator changes to '!',
> 	    which is a bit more intuitive too. Dhcp-host directives
> 	    can set more than one tag now. The old '#' NOT,
> 	    "net:" prefix and no-prefixes are still honoured, so
> 	    no existing config file needs to be changed, but
> 	    the documentation and new-style config files should be
> 	    much less confusing.
>
>
>
> On Fri, Mar 4, 2011 at 10:58 AM, Michael P. McDonnell <bzaks1424 at gmail.com
> > wrote:
>
>> I'm on version 2.45 - it was the default with SLES. I'll see if I can find
>> something closer to 2.5.x, is there a "minimum" just in case I find an RPM.
>>
>> By the way - thank you so much, you guys have been insanely helpful.
>>
>>
>> On Fri, Mar 4, 2011 at 10:55, richardvoigt at gmail.com <
>> richardvoigt at gmail.com> wrote:
>>
>>> The behavior you're seeing exactly matches the old description, when
>>> "tag:" wasn't a keyword.
>>>
>>> *-F,
>>> --dhcp-range=[[net:]network-id,]<start-addr>,<end-addr>[[,<netmask>],<broadcast>][,<default
>>> lease time>]*Enable the DHCP server. Addresses will be given out from
>>> the range <start-addr> to <end-addr> and from statically defined addresses
>>> given in *dhcp-host* options. If the lease time is given, then leases
>>> will be given for that length of time. The lease time is in seconds, or
>>> minutes (eg 45m) or hours (eg 1h) or the literal "infinite". The minimum
>>> lease time is two minutres. This option may be repeated, with different
>>> addresses, to enable DHCP service to more than one network. For directly
>>> connected networks (ie, networks on which the machine running dnsmasq has an
>>> interface) the netmask is optional. It is, however, required for networks
>>> which receive DHCP service via a relay agent. The broadcast address is
>>> always optional. On some broken systems, dnsmasq can listen on only one
>>> interface when using DHCP, and the name of that interface must be given
>>> using the *interface* option. This limitation currently affects OpenBSD
>>> before version 4.0. It is always allowed to have more than one dhcp-range in
>>> a single subnet. The optional network-id is a alphanumeric label which marks
>>> this network so that dhcp options may be specified on a per-network basis.
>>> When it is prefixed with 'net:' then its meaning changes from setting a tag
>>> to matching it. Only one tag may be set, but more than one tag may be
>>> matched. The end address may be replaced by the keyword *static* which
>>> tells dnsmasq to enable DHCP for the network specified, but not to
>>> dynamically allocate IP addresses. Only hosts which have static addresses
>>> given via *dhcp-host* or from /etc/ethers will be served.
>>>
>>>
>>> In this case, "tag:custom" is seen as the network-id being set, and no
>>> tags are being matched.
>>>
>>> You should probably upgrade to a newer version.
>>>
>>> On Fri, Mar 4, 2011 at 10:51 AM, richardvoigt at gmail.com <
>>> richardvoigt at gmail.com> wrote:
>>>
>>>> It looks like the dhcp-range is setting a tag instead of matching it.
>>>>
>>>>
>>>> If you took out "tag:custom," from the dhcp-range and restart dnsmasq,
>>>> would the query still show "tags: tag:custom"
>>>>
>>>> Wait a second.  I don't think the tags line is supposed to contain
>>>> "tag:".  What version are you running?
>>>>
>>>
>>>>
>>>> On Fri, Mar 4, 2011 at 10:45 AM, Michael P. McDonnell <
>>>> bzaks1424 at gmail.com> wrote:
>>>>
>>>>> I understand this isn't EXACTLY the scenario I need to fix for - but I
>>>>> kind of want to learn what I'm doing wrong as well. (This will help me learn
>>>>> more about dhcp in general)
>>>>>
>>>>> Here's my dnsmasq.conf:
>>>>> ###DNSMASQ CONF
>>>>> no-resolv
>>>>> no-poll
>>>>> dhcp-vendorclass=set:custom,"Magic Server"
>>>>> dhcp-range=tag:custom,10.230.240.50,10.230.240.150,12h
>>>>> dhcp-range=10.230.240.151,10.230.240.254,12h
>>>>> dhcp-script=/root/bin/doit
>>>>> log-queries
>>>>> log-dhcp
>>>>> #####END
>>>>>
>>>>> Here's my ***current* dhclient.conf
>>>>> ###DHCLIENT CONF
>>>>> send dhcp-lease-time 3600;
>>>>> send vendor-class-identifier "sample";
>>>>> #send vendor-class-identifier "Magic Server";
>>>>> request subnet-mask, broadcast-address, routers,
>>>>>         interface-mtu, host-name, domain-name,
>>>>>         domain-name-servers, nis-domain, nis-servers,
>>>>>         nds-context, nds-servers, nds-tree-name,
>>>>>         netbios-name-servers, netbios-dd-server,
>>>>>         netbios-node-type, netbios-scope, ntp-servers;
>>>>> require subnet-mask;
>>>>> timeout 60;
>>>>> retry 60;
>>>>> reboot 10;
>>>>> select-timeout 5;
>>>>> initial-interval 2;
>>>>> #####END
>>>>>
>>>>> Here's what I found as the output:
>>>>> Mar  4 10:33:54 pxeserv dnsmasq[18619]: Available DHCP range:
>>>>> 10.230.240.50 -- 10.230.240.150
>>>>> Mar  4 10:33:54 pxeserv dnsmasq[18619]: Available DHCP range:
>>>>> 10.230.240.151 -- 10.230.240.254
>>>>> Mar  4 10:33:54 pxeserv dnsmasq[18619]: Vendor class: sample
>>>>> Mar  4 10:33:54 pxeserv dnsmasq[18619]: DHCPREQUEST(eth0) 10.230.240.54
>>>>> 00:50:56:b9:00:05
>>>>> Mar  4 10:33:54 pxeserv dnsmasq[18619]: DHCPACK(eth0) 10.230.240.54
>>>>> 00:50:56:b9:00:05
>>>>> Mar  4 10:33:54 pxeserv dnsmasq[18619]: requested options: 1:netmask,
>>>>> 28:broadcast, 3:router, 26:mtu,
>>>>> Mar  4 10:33:54 pxeserv dnsmasq[18619]: requested options: 12:hostname,
>>>>> 15:domain-name, 6:dns-server,
>>>>> Mar  4 10:33:54 pxeserv dnsmasq[18619]: requested options:
>>>>> 40:nis-domain, 41:nis-server, 87, 85, 86,
>>>>> Mar  4 10:33:54 pxeserv dnsmasq[18619]: requested options:
>>>>> 44:netbios-ns, 45:netbios-dd, 46:netbios-nodetype,
>>>>> Mar  4 10:33:54 pxeserv dnsmasq[18619]: requested options:
>>>>> 47:netbios-scope, 42:ntp-server
>>>>> Mar  4 10:33:54 pxeserv dnsmasq[18619]: tags: tag:custom
>>>>> Mar  4 10:33:54 pxeserv dnsmasq[18619]: sent size:  1 option:
>>>>> 53:message-type  05
>>>>> Mar  4 10:33:54 pxeserv dnsmasq[18619]: sent size:  4 option:
>>>>> 54:server-identifier  0a:e6:f0:64
>>>>> Mar  4 10:33:54 pxeserv dnsmasq[18619]: sent size:  4 option:
>>>>> 51:lease-time  00:00:0e:10
>>>>> Mar  4 10:33:54 pxeserv dnsmasq[18619]: sent size:  4 option: 58:T1
>>>>> 00:00:07:08
>>>>> Mar  4 10:33:54 pxeserv dnsmasq[18619]: sent size:  4 option: 59:T2
>>>>> 00:00:0c:4e
>>>>> Mar  4 10:33:54 pxeserv dnsmasq[18619]: sent size:  4 option:
>>>>> 1:netmask  ff:ff:ff:00
>>>>> Mar  4 10:33:54 pxeserv dnsmasq[18619]: sent size:  4 option:
>>>>> 28:broadcast  0a:e6:f0:ff
>>>>> Mar  4 10:33:54 pxeserv dnsmasq[18619]: sent size:  4 option:
>>>>> 3:router  0a:e6:f0:64
>>>>> Mar  4 10:33:54 pxeserv dnsmasq[18619]: sent size:  4 option:
>>>>> 6:dns-server  0a:e6:f0:64
>>>>>
>>>>>
>>>>>
>>>>> On Fri, Mar 4, 2011 at 10:19, richardvoigt at gmail.com <
>>>>> richardvoigt at gmail.com> wrote:
>>>>>
>>>>>> Does dnsmasq have dhcp logging enabled?  Can you paste the few lines
>>>>>> associated with giving the client an address from the wrong block?
>>>>>>
>>>>>>
>>>>>> On Fri, Mar 4, 2011 at 10:15 AM, Michael P. McDonnell <
>>>>>> bzaks1424 at gmail.com> wrote:
>>>>>>
>>>>>>> I'm was just doing a dhclient eth0 on the client. So I guess that
>>>>>>> would make sense not killing the lease all together...
>>>>>>>
>>>>>>> so I tried doing a dhclient -r eth0, then doing a dhclient eth0. No
>>>>>>> luck :-/
>>>>>>>
>>>>>>>
>>>>>>> On Fri, Mar 4, 2011 at 10:12, richardvoigt at gmail.com <
>>>>>>> richardvoigt at gmail.com> wrote:
>>>>>>>
>>>>>>>> Are you releasing the lease after changing the client configuration,
>>>>>>>> or renewing an existing lease?
>>>>>>>>
>>>>>>>> On Thu, Mar 3, 2011 at 11:31 PM, Michael P. McDonnell <
>>>>>>>> bzaks1424 at gmail.com> wrote:
>>>>>>>>
>>>>>>>>> So I'd like to use vendor class identifer to create two different
>>>>>>>>> ranges in dnsmasq, and I'm not entire sure how to go about that.
>>>>>>>>>
>>>>>>>>> dhcp-vendorclass=set:custom,"Sample Vendor Class"
>>>>>>>>> dhcp-range=tag:custom,192.168.0.50,192.168.0.150,12h
>>>>>>>>> dhcp-range=192.168.0.151,192.168.0.254,12h
>>>>>>>>>
>>>>>>>>> However - if I take a single client and flip the
>>>>>>>>> vendor-class-identifier on or off in the dhclient.conf, I don't get a
>>>>>>>>> different IP.
>>>>>>>>> Am I doing something wrong? Should I be looking to do something
>>>>>>>>> differently in my config?
>>>>>>>>>
>>>>>>>>> Also - would it be possible for me to exactly specify to only run
>>>>>>>>> dhcp-script for a specific lease? (so only the dhcp leases tagged with
>>>>>>>>> "custom" ? ) Or do I need to just put that logic in the script that the
>>>>>>>>> dhcp-script is calling?
>>>>>>>>>
>>>>>>>>> Thanks for your help in advance!
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> Dnsmasq-discuss mailing list
>>>>>>>>> Dnsmasq-discuss at lists.thekelleys.org.uk
>>>>>>>>> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20110304/fe76a430/attachment.htm 


More information about the Dnsmasq-discuss mailing list