5

Once dhcpd (IPv4) is started, is there any way to check its internal pool status? e.g how many addresses are available?

I checked man(8) dhcpd, there's no signals/files available for that info.

Mat
  • 51,578
  • 10
  • 158
  • 140
daisy
  • 53,527
  • 78
  • 236
  • 383

3 Answers3

8

Checking status of leases is easiest with analysis tool.

http://dhcpd-pools.sourceforge.net/

After building the dhcpd-pools, you can use dhcpd.conf and dhcpd.leases as inputs to the command ./dhcpd-pools.

heemayl
  • 54,820
  • 8
  • 124
  • 141
kerolasa
  • 267
  • 2
  • 2
6

On Ubuntu there is the file /var/lib/dhcp/dhcpd.leases, but it is rather verbose and you probably need a little script if you want more high level statistics. I am unaware of existing tools to do this.

There is a separate man page for this file man dhcpd.leases describing the database format.

jippie
  • 13,756
  • 10
  • 44
  • 64
  • 1
    Thanks for the filename , on arch linux I find it was located at `/var/state/dhcp/dhcpd.leases` – daisy May 27 '12 at 07:57
  • On X random linux distro, the location of the lease file is probably defined in the dhcpd.conf file. It might possibly use the compiled-in default though. The config file usually lives under /etc (although perhaps in a subdirectory; red hat puts it in /etc/dhcp/dhcpd.conf). – Dan Pritts Jul 09 '13 at 16:12
  • 1
    @DanPritts The parameter is called `lease-file-name` in `dhcpd.conf` IIRC. – jippie Jul 09 '13 at 17:37
1

Here is a good command to show dhcp leases in nice format.

Check it out: Command to list assigned dhcp addresses

Hojat Modaresi
  • 431
  • 4
  • 9