[Dnsmasq-discuss] Automatic DHCP client naming

Simon Kelley simon at thekelleys.org.uk
Fri Apr 16 21:04:59 BST 2010


Ferenc Wagner wrote:
> Simon Kelley <simon at thekelleys.org.uk> writes:
> 
>> Ferenc Wagner wrote:
>>
>>> Is there any way in dnsmasq to push a hostname to a DHCP client even if
>>> it didn't report (or ask for) one? 
>> This much is easy:
>> dhcp-host=00:11:22:33:44:55,myhost
> 
> Yeah, it isn't a problem in itself.
> 
>>> I'd like to automatically name my clients based on their MAC
>>> addresses, like 00:11:22:33:44:55 should get the hostname
>>> 00-11-22-33-44-55.domain.tld.
>> That's not possible, other then by enumerating all possible MAC
>> addresses in the configuration file.
> 
> That sure would make for a biggish configuration file...
> 
>>> Currently, I can get this effect only if the client sends its
>>> hostname in the DHCP request; then dnsmasq adds the correct domain,
>>> registers the name in its DNS database and sends back the fully
>>> qualified address.  Good.  But I'd like to avoid generating the
>>> hostname on the clients before starting DHCP.
>> It would be possible to add that functionality, probably with something
>> like dhcp-ignore-names, say "dhcp-mac-as-name", but only for a fixed
>> name format (should there be a prefix?)
> 
> Hmm, I'd rather extend the wildcarding already present in dhcp-mac with
> something like
> 
> dhcp-mac=*:*:*:*:*:*,PREFIX*-*-*-*-*-*SUFFIX
> 
> or
> 
> dhcp-mac=*,PREFIX*SUFFIX
> 
> with the replacement of colons implied.  On the other hand, I've found
> http://thread.gmane.org/gmane.network.dns.dnsmasq.general/3774/focus=3778
> just now...  Well, managing a registry from dhcp-script is almost
> acceptable, apart from the first run.  Here is another idea: why not let
> dhcp-script write back the hostname to dnsmasq?  That way no separate
> registry nor daemon restarts would be needed.

Restart aren't needed: it's possible to re-read dhcp-host  lines on
SIGHUP is they are kept in a separate file.

Getting data back from the dhcp-script is very difficult: it executes
somewhat asynchronously so that the daemon can't ever be blocked waiting
for a script to finish.


Simon.





More information about the Dnsmasq-discuss mailing list