[Dnsmasq-discuss] Ideas for handing out "per blade" information
simon at thekelleys.org.uk
Thu Oct 22 13:13:16 BST 2009
Paul Smith wrote:
> Hi all.
> I have an environment with lots of blades (on the order of 150-200 or
> so), all getting IP information from a central server using dnsmasq as
> the DHCP server.
> What I need to do is provide some information to each blade when it
> registers, and (some of) this information will be specific to a given
> blade (said another way, it will be different for each blade). I was
> hoping to use the DHCP response to supply this information, rather than
> invent some new protocol of my own, create a daemon, etc. etc.
> On the server I actually already know the MAC addresses that the blades
> will register with, so I was going to use that as a key to look up the
> per-blade information when the DHCP request is received.
> Also, ideally the information would be obtained by running a script with
> the MAC address as the argument, since these addresses can change during
> the runtime of the system (someone can pull a blade and put a new one,
> with a different MAC, in, for example, or they could even swap two
> blades which means the information I want give them will change, since
> some of it is position-dependent) and I'd prefer to grab these
> dynamically rather than having some kind of timeout etc. But, if that's
> not possible I can work with it.
> I've been looking through the dnsmasq man page and there are a lot of
> options, but I'm not sure how to use them to do what I want.
> The only mapping it appears that I can do based on MAC is dhcp-host
> (maybe creating a file and giving it with dhcp-hostsfile). But the only
> way I can set options, that I can see, is using dhcp-option which is
> based on network-id. There is no way to set the network-id based on the
> MAC etc. that I can see. There doesn't seem to be any way to give
> specific options for a specific client.
> Soooo... anyone have any ideas for me?
network-ids are sadly misnamed: they have grown into much more general
tags now. You can certainly set a net-id tag in a dhcp-host line, and
then use that to select the options to be sent to a particular host.
There's no way to change this information completely dynamically. You
can however put all the dhcp-host information into a file and point at
that file with --dhcp-hostsfile, similarly with options and
dhcp-optsfile. Unlike a general configuration, these files _are_ re-read
when dnsmasq gets SIGHUP.
More information about the Dnsmasq-discuss