Discussion:
[Dnsmasq-discuss] dnsmasq.leases file format?
Gordon Croft
2005-02-10 18:16:47 UTC
Permalink
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, unsuccessful.

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 142.174.150.208 M61480 01:00:b0:d0:01:32:86
1108087006 00:60:38:dd:c5:63 142.174.150.184 * *
1108072389 00:06:5b:e8:e3:f7 142.174.150.248 M70509 01:00:06:5b:e8:e3:f7
1108091987 00:b0:d0:a6:b3:23 142.174.150.137 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?
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?
Next is the mac again, how come?
Simon Kelley
2005-02-10 19:11:09 UTC
Permalink
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,
unsuccessful.
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
1108086503 00:b0:d0:01:32:86 142.174.150.208 M61480 01:00:b0:d0:01:32:86
1108087006 00:60:38:dd:c5:63 142.174.150.184 * *
1108072389 00:06:5b:e8:e3:f7 142.174.150.248 M70509 01:00:06:5b:e8:e3:f7
1108091987 00:b0:d0:a6:b3:23 142.174.150.137 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?
Check.
Next is the IP address assigned to the host?
Check.
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.

HTH

Simon.

Loading...