[Dnsmasq-discuss] how to specify dhcp options by machine name?

Simon Kelley simon at thekelleys.org.uk
Thu Jan 4 10:26:05 GMT 2007


Carlos Carvalho wrote:

> Hmmm, from your suggestion and the example config in the package I see
> that the order of fields doesn't matter. This is not clear in the
> manual. Also, from the syntax in the manual it's not possible to use
> both id:* and hwaddr when in fact it seems to be. 

Documentation bugs, agreed.

> I also don't
> understand how one can specify both a client-id and * in the id:
> field; they look mutually exclusive. 

The algorithm for finding which dhcp-host line to use (there is only
ever one in use, for any DHCP transaction) looks (simplified) like this:

if (client provides client-id)
	for (all dhcp-host lines, in indeterminate order)
	     if (dhcp-host line has id: field AND
                 dhcp-host line id: field matches client provided id)
                      search complete

if (client provides non-wildcard MAC)
        for (all dhcp-host lines, in indeterminate order)
             if (dhcp-host line has non-wildcard MAC field AND
                 dhcp-host line MAC field matches client provided MAC)
                      search complete

if (client provides hostname)
        for (all dhcp-host lines, in indeterminate order)
             if (dhcp-host line has hostname AND
                 dhcp-host line hostname field matches client hostname)
                      search complete

if (client provides wildcard MAC)
        for (all dhcp-host lines, in indeterminate order)
             if (dhcp-host line has wildcard MAC field AND
                 dhcp-host line MAC field matches client provided MAC)
                      search complete


So the matching for MAC and client-id is a OR function: either can
match. In almost all cases only one would be provided, so this is
irrelevant. I have to stretch a bit to find a case where having both is
actually useful: maybe a client which doesn't provide a client-id during
boot (PXE boot ROMS frequently don't) and which provides a client-id but
no MAC address whilst doing DHCPINFORM. (I have seen this too.)



> Additionally, what's the meaning
> of an empty id: field, that is, without specifying either a client-id
> or *? Looks like one of them must appear. Shouldn't the syntax then be
> 
> dhcp-host=[<hwaddr>][,id:<client_id>|*][,net:<netid>][,<ipaddr>]...?
> 

Also agreed: an empty id: is meaningless (and will be silently ignored,
I think.)


I'll tweak the documentation.

BTW: a general point to the list. I'm aware that the dnsmasq docs are a
weak point, and I'd be very happy to get any contributions to improve
them. The Man page is generally complete, but it's very terse, and could
be improved, as this thread shows. The other documentation (setup.html
and bits of the FAQ) could be profitably expanded into a comprehensive
task-based HOWTO.

Cheers

Simon.


> _______________________________________________
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss at lists.thekelleys.org.uk
> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
> 




More information about the Dnsmasq-discuss mailing list