[Dnsmasq-discuss] client name via DHCP
Simon Kelley
simon at thekelleys.org.uk
Thu Feb 10 19:48:26 GMT 2011
Helmut Hullen wrote:
> Hallo, Richard,
>
> Du meintest am 10.02.11:
>
>>>>> when I use the ISC DHCP, then I can see the name of the Windows
>>>>> client in "/var/state/dhcp/dhcp.leases".
>>>>>
>>>>> With dnsmasq as DNS and DHCP server I haven't found this feature -
>>>>> is it somewhere hidden?
>
> [...]
>
>> The hostname is in the dnsmasq.leases file. Exact directory depends
>> on how you installed dnsmasq. If you're using the leasefile-ro
>> option, then getting this information is dependent on your script
>> saving it somewhere. If the client doesn't send a hostname, the
>> hostname column will have "*" or the mac address.
>
> Sorry - there's a difference:
>
> ISC DHCP shows
>
> lease 192.168.0.60 {
> starts 4 2011/02/10 08:13:27;
> ends 4 2011/02/24 08:13:27;
> cltt 4 2011/02/10 08:13:27;
> binding state active;
> next binding state free;
> rewind binding state free;
> hardware ethernet 74:f0:6d:00:7b:f5;
> uid "\001t\360m\000{\365";
> client-hostname "KB-PC";
> }
>
> and "dnsmasq" shows
>
> 1305130516 74:f0:6d:00:7b:f5 192.168.0.60 Client-A60 01:74:f0:6d:00:7b:f5
>
> The client's own name is "KB-PC", dnsmasq reads "Client-A60" from a list
> on the server (which is completely independent from the "real" client's
> name).
>
> I want to see the "real" client's name, it's a better help for guessing
> who's the owner of the machine.
>
So you want the hostname the client sends to the DHCP server, which is
not used by dnsmasq because it's overridden by on-the-server
configuration? That is available: it's set in the environment variable
DNSMASQ_SUPPLIED_HOSTNAME given to the lease-change script. (All the
environment variables are prefixed with DNSMASQ_, it really is the
client's idea of the hostname, not dnsmasq's.
Writing a little script which logs this and the dnsmasq hostname, MAC
address, IP address or anything else useful should give you a file which
can be searched.
HTH
Simon.
More information about the Dnsmasq-discuss
mailing list