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

Simon Kelley simon at thekelleys.org.uk
Wed Jan 3 10:56:20 GMT 2007


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.

> 
> It'd be very convenient if one could use the machine name from the dns
> side as a network-id in dhcp-option...
> 

Adding hostnames to the network-id namespace is likely to break existing
installations in subtle ways. Adding a separate "match hostname" is
possible, but I think that having DHCP options unique to individual
machines is fairly rare: mostly assigning options to classes of machines
 is more useful?

> 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.

You could go further, and create one file per host which contains the
dhcp-host and dhcp-option settings for that host. Put all the files in a
directory and include them all with conf-dir=



> 
> Out of curiosity, dnsmasq can be run in name-server-only mode but it
> seems it cannot be used in dhcp-server-only mode. Makes me wonder why...
> 

Mainly history: dnsmasq started off as just a name-server and the DHCP
function was added in version 2. You can move the port it listens on if
it gets in the way of another nameserver.


> Happy new year to all.
> 
> _______________________________________________
> 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