[Dnsmasq-discuss] generating hostname on the fly, base on mac address,
Santiago Zarate
santiago at zarate.net.ve
Fri Mar 5 14:25:40 GMT 2010
Hmm, in my organization we have a database with the macadresses, (and
the whole computer in fact), we have already a naming scheme for every
computer (for example, DSA its for a particular departament, or DIC
which is for the IT departament... so, the hostname could be sometimes
DIC-01-<serial-number>) which is the one we use to generate hostnames
automatically... so when we add a new host, only that line gets into
the file and its just reloaded...
2010/3/5 Sébastien G <sebastien at alternatives.ca>:
> hi folks,
>
> Dnsmasq is a great software, I use it everywhere I can! Now, I'm
> facing an issue when automating the installation process of
> Ubuntu/Debian. To make everything follow, I want to configure dnsmasq
> to provide to a new host being installed a generated hostname.
> (something like pc<XX-XX-XX-XX-XX-XX> (the mac adress of the host)
>
> I know about the /etc/ethers where I can assign hostname and ip to a
> specific mac address. The problem of using the /etc/ethers method is
> that I need know the mac adress *before* doing the installation processs
> and add it to the config file. This is not very pratical for us when
> doing a lot of installations.
>
> So far, I've found that the dhcp-script could be helpful here. This is a
> little script I've encounter, that has the basic idea of what I want to do.
> ----------------
> /usr/bin/add_new_host.sh*:
> #!/bin/bash
> if [ "$1" -eq "del" ]; then
> exit
> fi
> isnew_mac=$(cat /etc/dnsmasq.conf|grep -v "^#"|grep "dhcp-host"|grep
> "$2")
>
> if [ -z "$isnew_mac" ]; then
> echo dhcp-host=$2,$3 >> /etc/dnsmasq.conf
> /etc/init.d/dnsmasq restart
> fi
>
> ref:
> http://linuca.org/pipermail/linuxcantabria/2006-June/007314.html
> ----------------
>
> Doing a restart of the service in this script doesn't sound "right" to
> me. but well...
I'm Ok with having to restart DNSMASQ everytime this happens, but
actually... i would love dnsmasq to automatically refresh the
addresses/macaddresses/etc/ without the need of a restart (and without
adding a particular hostname/ip to /etc/hosts.
> Do people have had an issue like this before? is dhcp-script the way to
> go to generate hostname on the fly base on the mac address?
>
> Thanks for sharing,
>
> Sébastien
>
>
> _______________________________________________
> 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