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

Carlos Carvalho carlos at fisica.ufpr.br
Thu Jan 4 00:23:44 GMT 2007


Simon Kelley (simon at thekelleys.org.uk) wrote on 3 January 2007 10:56:
 >Carlos Carvalho wrote:
 >> I'm preparing to install dnsmasq here and I need to give specific dhcp
 >> options to several tens of machines. The way to do it is to assign
 >> network-id's to them and use the dhcp-option clause. However how can
 >> this assignment be done easily? I've only found dhcp-mac (for specific
 >> machines). This makes reading /etc/ethers (wonderful feature) nearly
 >> useless since I still have to create a long list of dhcp-mac
 >> statements with the mac addresses.
 >
 >If your /etc/ethers has hostnames and MAC addresses, then you can use
 >dhcp-host options to associate network-ids with hostnames, that at least
 >avoids repeating MAC addresses.

Yes, thanks. I overlooked this possibility. This is exactly the way to
assign a network-id to a machine without adding a lot of extra cruft
to the config.

 >> I also noticed that there's no possibility of reading another file
 >> instead of /etc/ethers, as can be done for dns with addn-hosts (-H).
 >> This could be useful. Also, since this file would be for dnsmasq only,
 >> one could add a third column with a (optional) network-id for the
 >> machines that need specific options (hint, hint).
 >
 >Here's an alternative: take your
 >
 >hostname   MAC  netid
 >
 >/etc/ethers file, rename it and re-format it as
 >
 >dhcp-host=<hostname>,MAC,net:<netid>
 >
 >then use the conf-file= option to include it from /etc/dnsmasq.conf That
 >gives you a host-configuration file split off from the main config file.

Yes, that's what I'll be doing.

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. I also don't
understand how one can specify both a client-id and * in the id:
field; they look mutually exclusive. 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>]...?



More information about the Dnsmasq-discuss mailing list