Hello

Apparently no one fixed that bug in the last two years so I made
another attempt :)

Attached you will find a much improved version of the script.
Apart from fixing the two wishes you made it got some command
line options, too:

# ./dhcp-lease-list --help
Prints active DHCP leases.

Usage: ./dhcp-lease-list [options]
 --help      shows this help
 --parsable  machine readable output with full dates
 --last      prints the last (even if end<now) for every MAC
 --all       prints all entries i.e. more than one per MAC


test2:~# ./dhcp-lease-list --all
#      MAC            IP             valid until           manufactorer
08:00:27:0b:e2:b5  10.159.77.26  2008-07-11 01:30:20  CADMUS COMPUTER
SYSTEMS
08:00:27:4d:d8:0d  10.159.77.27  2008-07-13 21:58:59  CADMUS COMPUTER SYSTEMS
08:00:27:4d:d8:0d  10.159.77.127  2008-07-13 11:58:59  CADMUS COMPUTER
SYSTEMS


test2:~# ./dhcp-lease-list --last
#      MAC            IP             valid until           manufactorer
08:00:27:0b:e2:b5  10.159.77.26  2008-07-11 01:30:20  CADMUS COMPUTER
SYSTEMS
08:00:27:4d:d8:0d  10.159.77.27  2008-07-13 21:58:59  CADMUS COMPUTER SYSTEMS


test2:~# ./dhcp-lease-list
#      MAC            IP             valid until           manufactorer
08:00:27:4d:d8:0d  10.159.77.27  2008-07-13 21:58:59  CADMUS COMPUTER
SYSTEMS


test2:~# ./dhcp-lease-list --parsable --last
MAC 08:00:27:0b:e2:b5 IP 10.159.77.26 BEGIN 2008-07-11 01:20:20 END
2008-07-11 01:30:20 MANUFACTORER CADMUS COMPUTER SYSTEMS
MAC 08:00:27:4d:d8:0d IP 10.159.77.27 BEGIN 2008-07-13 21:48:59 END
2008-07-13 21:58:59 MANUFACTORER CADMUS COMPUTER SYSTEMS

The script and a man page are attached.

bye,

-christian-


On 2008-01-14 Andrew Pollock wrote:
> On Fri, Sep 29, 2006 at 03:16:54PM +0200, Christian Hammers wrote:
> > Package: dhcp3-server
> > Version: 3.0.1-2
> > Severity: wishlist
> > Tags: patch
> >
> > Hello
> >
> > Please find attached a little script that generates the following
output. It's very handy to see which DHCP address a just plugged in
computer got (in case you just turn a server on and then try to ssh to
it).
> >
> > The manufactor list should be provided as a copy, maybe updateable via
/usr/bin/update-oui-list like update-pci-ids...
> >
>
> I've just taken a look at this script, and it's good, but it could do
with
> a little bit more work.
>
> It should fail more gracefully if /usr/share/misc/oui.txt doesn't exist,
and it shouldn't bother reporting entries in /var/lib/dhcp3/dhcpd.leases
that are past their end date. My file has a bunch of entries in it that
are a couple of years old, and are very much inactive.
>
> If you address these issues, and make the script fail gracefully if
libtimedate-perl (and therefore Date::Format) isn't installed, I'll add
it
> to the dhcp3-server package.
>
> regards
>
> Andrew


Attachment: dhcp-lease-list
Description: Binary data

Attachment: dhcp-lease-list.8
Description: Binary data

Reply via email to