[Dnsmasq-discuss] Hostname creating; DHCP NAKs

Simon Kelley simon@thekelleys.org.uk
Thu, 09 Dec 2004 07:37:52 +0000


Will Murnane wrote:
> Hello all,
>   I've had two issues recently with dnsmasq.  First, I'd like to
> generate unique names for clients, and second, there's a bit of a
> glitch with DHCP clients who attempt to get leases twice in a short
> while.
> 
> The first issue is this:  I have a decent number of client machines
> who I'd like to have hostnames defined for.  However, I'd prefer not
> to have to give them explicit names in dnsmasq.conf, but have them
> automatically assigned.  I had this working in dhcpd (version ) with a
> config file line like this:
> option host-name = binary-to-ascii(10, 8, ".", leased-address);
> which allowed me to see immediately what IP they were at (this
> generates hostnames like "10.2.3.4", an ascii string).  The other
> possibility is to name the clients something like "client1",
> "client2", et cetera.  Is there a way to do this with dnsmasq?

There's no way to do this with dnsmasq. Note that it's possible for the 
client to supply the hostname, so you might be able to automatically 
create a name based on, say, the MAC address, by doing a bit of 
scripting around the DHCP client invocation.

> 
> The other issue I've had is this:  The "client" machines are booted
> via Etherboot, and then once they get to loading the OS, they run
> udhcpc so that the network is set up properly.  This shows up on the
> client end as:
> udhcpc[137]: Sending discover...
> udhcpc[137]: Sending select for 10.6.7.40..
> udhcpc[137]: Recieved DHCP NAK
> and on the server (in /var/log/messages): 
> dnsmasq[1670]: DHCPDISCOVER(eth0) 00:d0:09:da:88:0f
> dnsmasq[1670]: DHCPOFFER(eth0) 10.6.7.40 00:d0:09:da:88:0f
> dnsmasq[1670]: DHCPREQUEST(eth0) 10.6.7.40 00:d0:09:da:88:0f
> dnsmasq[1670]: DHCPACK(eth0) 10.6.7.40 00:d0:09:da:88:0f
> Both of these messages are repeated every three seconds for almost
> exactly 10 minutes, and then the client's third line changes to this:
> udhcpc[137]: Lease of 10.6.7.40 obtained, lease time 172800
> and all is well.  No change on the server side.  Any idea what's causing this?
> 

If the DHCP NAKs were coming from dnsmasq then they would be logged. My 
immediate reaction is that there may be another DHCP server operating on 
  your network which is interfering. (It's possible to have more than 
one DHCP server on a network, but they have to cooperate, or at very 
least be explicitly configured to not step on each other's toes.)

You need to install tcpdump, or preferably ethereal, and capture all the 
relevant DHCP packets. If it's not obvious what's going on send the dump 
file to me off-list and I'll take a look.

Cheers

Simon.