[Dnsmasq-discuss] dnsmasq.leases file format?
Thu, 10 Feb 2005 19:11:09 +0000
Gordon Croft wrote:
> Hello all, Iíve been looking for some information describing the format
> of the /var/lib/misc/dnsmasq.leases file and have been, to date,
> Perhaps itís a matter of the format being so simple that itís obvious to
> most people or perhaps itís a case of me being too simple to understand
> itÖeither way I need some help!
> Iím running dnsmasq on an Alpha box and the dnsmasq.leases file looks
> like this:
> 1108086503 00:b0:d0:01:32:86 184.108.40.206 M61480 01:00:b0:d0:01:32:86
> 1108087006 00:60:38:dd:c5:63 220.127.116.11 * *
> 1108072389 00:06:5b:e8:e3:f7 18.104.22.168 M70509 01:00:06:5b:e8:e3:f7
> 1108091987 00:b0:d0:a6:b3:23 22.214.171.124 m58105 01:00:b0:d0:a6:b3:23
> First question is about the time, Iím assuming the first field contains
> this information (in epoch format?), is this the Ďgrant timeí of the
> lease or the expiry time? Is there a simple way (remember I said I was
> simple!) to convert from this format to ďnormalĒ date/time?
Expiry time, in epoch format (seconds since start of 1970) the C library
function ctime() will convert this, I'm not sure if there's a command
line utility. Note that there's a comile-time switch for use on machines
without a hardware RTC that changes this to relative time.
> The next field is the mac address?
> Next is the IP address assigned to the host?
> Next is the host name? I seem to remember that with Linux boxes you
> need to add a statement somewhere so the host name will appear here?
Check. Note that this should just be the name, not the FQDN (ie no dots)
You need to tell the DHCP client to send the hostname, different clients
do that in different ways. Alternatively associate the hostname with a
MAC address/client-id using dhcp-host= in /etc/dnsmasq.conf
> Next is the mac again, how come?
Client-id. This can be set by the client, or might default to the MAC
address prefixed by the hardware type (01 = ethernet) or might not be
sent at all, in which case the field will be "*". If it exists, it's
used to identify the host in preference to the MAC address.