Version 0.60
7 October 2001
DHCPStatus
What is DHCPStatus ?
DHCPStatus is a query tool for browsing information stored in DHCPD's
configuration and leases files, dhcpd.conf and dhcpd.leases.
It correlates the subnet details that you configure in the conf file with
the lease records that DHCPD maintains in its lease file. You can thus
obtain an overall picture of your DHCP environment, as well as view details
of individual leases for each IP.
DHCPD, by the way, is
a DHCP server daemon, produced by the Internet
Software Consortium.
DHCPStatus can be run either as a CGI script and viewed via a
web browser, or as a command-line tool that generates simple text output.
The CGI/web interface requires that you run a CGI-capable web server on
your DHCPD server machine. The command-line tool merely requires
that you have a shell login on the server.
What information does DHCPStatus give you ?
DHCPStatus provides information
about your DHCPD environment at two levels: an overall summary report,
and a subnet detail report.
Summary report
Each row of the summary report contains information for a single subnet
defined in the dhcpd.conf file. The information described for each
subnet is:
-
the subnet address,
-
netmask,
-
the range of IP addresses that fall within the subnet,
-
the router(s) for the subnet,
-
the number of IP addresses that are defined in the dynamic pool for that
subnet,
-
the number of IP addresses in the dynamic pool that are in use, and
-
the number of IP addresses in the dynamic pool that are free.
All this information is obtained from the
dhcpd.conf and dhcpd.leases files, in their standard formats. In addition,
if you use an extra format standard for commenting each subnet in your
dhcpd.conf file, this utility will find those comments and include them
as a "Location" field in the summary report.
Subnet detail report
For each subnet that is summarised by the summary report, it is possible
to obtained a detailed subnet report.
The information displayed in the subnet detail report includes all of
the information that is produced by the summary report for that subnet,
as well as a row of information on each IP address in the subnet. The information
for each IP address includes the lease status ("active", "free", or blank
for IP addresses not in the dynamic pool).
For each active address, the following
is displayed:
the start date of the lease,
the end date of the lease,
the mac address of the interface that has the IP address lease,
the DNS name of the interface that has the lease (as supplied by the client),
and
the hostname (or WINS name, assuming the client is using WINS) of the machine
that has the lease.
Overall, these two reports provide a quick
and easy way of summarising the status of your DHCPD server (a lot easier
than scanning through the dhcpd.leases file manually :-)
What does it look like ?
Here's what HTML and text
versions of the summary report look like.
And here are HTML and text
versions of the detail report.
Requirements
If you want to use
DHCPStatus, you'll
firstly need read access to your dhcpd.conf and dhcpd.leases files.
You'll also require Perl 5.003 (or later) installed on your system.
If you choose to run the CGI/web interface with DHCPStatus, then
you'll need to run a web server on your DHCPD server. The userid
that the web server runs as will need read access to your dhcpd.conf and
dhcpd.leases files. Alternatively, if you want to use the web
interface but don't want to install a web server on your DHCPD server,
then you could run the CGI script from another machine that had access
to the dhcpd.conf and dhcpd.leases files via, say, an NFS mount.
There are no pre-requisites for the command-line interface to DHCPStatus
(other than, obviously, Perl and read access to your DHCPD files).
The command-line version assumes that your terminal display width is 80
characters (you can easily change this width value in a .ini file).
However, if you have the Perl Term::ReadKey package installed on your system,
DHCPStatus will use it to determine your screen width (see http://search.cpan.org/search?dist=TermReadKey).
Where can I download DHCPStatus from ?
Installation
What's good about DHCPStatus ?
As mentioned above, DHCPStatus allows you to view everything you
want to know about your DHCP leases with a couple of mouse clicks of your
web browser, or by calling a command from a shell prompt. At a glance,
you can tell how many IP addresses are in the DHCPD pool for each of your
subnets, how many free addresses you have, and who has taken the leases.
Also, DHCPStatus is fairly fast - on my (well, my employer's)
Sun Ultra 450, it parses though the dhcpd.conf and dhcpd.leases
files, containing around 1300 leases, in about 2 seconds.
And, it's fairly easy to install.
What are its limitations ?
At present, DHCPStatus only reports
on the dynamic component of DHCP, ie. the dynamic pool of IP addresses
defined by the "range" statements in each "subnet" statement in dhcpd.conf.
Information in "group" and "host" statements is ignored. The reason for
this is that I wrote these scripts to keep track of where all my dynamic
IP addresses were going, and how many I had free - I already knew about
the static stuff. However, I plan to add info about groups and hosts soon
- it will make DHCPStatus more useful.
Also, things like bootp parameters are
ignored. If we were using DHCP for bootp here where I work, I'd add it
in, but we don't. I might add bootp information in some time.
DHCPStatus assumes that your
dhcpd.conf
and
dhcpd.leases files contain the correct syntax. If they don't,
you'll either get an "internal server error" from your web server as the
CGI script goes off the rails trying to parse the error, or (less likely,
I think I've taken care this), the scripts will go into an infinite loop,
your browser will hang, and you'll probably have a web server process spinning
its wheels on the server. I didn't put too much effort into checking syntax,
since I figured that
a) DHCPD
probably won't run if
dhcpd.conf
has a syntax error, and
b)
you're in real strife if your
dhcpd.leases
file has a syntax error.
There's also a problem with options and parameters within a "pool" statement
in DHCPD V3.0 dhcpd.conf files not being displayed (see below).
Support for DHCPD V3.0 file formats
The
DHCPD
3.0 server introduces a lot of new features that weren't present in
2.0 (server failover, conditional behaviour, DDNS, and other good stuff).
As a result, the syntax of the
dhcpd.conf and
dhcpd.leases
files has been extended.
DHCPStatus V0.53 will work with DHCPD V3.0 file formats (or
at least it has as far as I've tested it). That doesn't mean that
DHCPStatus
will display any of the new features, it just means that at least it won't
crash on you with a syntax error. Versions of
DHCPStatus prior
to V0.54 will only work with 2.0 and earlier releases of DHCPD (ie. they'll
most likely crash if you run them against DHCPD V3.0 files).
One slight problem is introduced with the dhcpd.conf
V3.0
file format. Up till DHCPD V2.0, network parameters and options (eg.
dns
server, wins server, broadcast address) could only be defined
globally or at a subnet level. As of DHCPD V3.0, it is possible to
define pools of addresses within a subnet, and specify options for
each pool. DHCPStatus doesn't recognise option definitions
within "pool" statements (yet), it ignores them. So, if you use pools
under DHCPD V3.0, be aware that the options that are displayed in DHCPStatus
for a particular subnet might be over-ridden by options at the pool level.
If you don't use DHCPD V3.0 with options inside "pool" statements, you
don't have to worry about any of this. One day I might fix it.
License
This product is freely available under
the terms of the
GNU General
Public License. However, if you find this product useful and wish to
offer appreciation for it, then please make a
contribution through the
Sourceforge Donation System.
Related software
DHCPStatus correlates the information in your dhcpd.conf
and dhcpd.leases files, and displays it in an easy-to-read tabular
format. The following programs also allow you to view DHCPD information:
-
Lanlord is a DHCP lease tracker
designed to run as a CGI program, written in Python. It lists all the entries
in the dhcpd.leases file in a tabular format.
-
dhcplst.pl is a CGI
program to browse and/or query dhcpd leases files.
-
Findhosts is another
CGI program, it lets you search for IP/MAC addresses in your dhcpd log
file.
The Author
DHCPStatus was written by Michael Grubits. Please send all criticism/praise/patches/change
requests/offers of telecommuting employment/etc. to
mjtg@users.sourceforge.net.
All trademarks
and copyrights on this page are properties of their respective owners.
Forum comments are owned by the poster. The rest is copyright ©1999-2000
VA Linux Systems, Inc. |