Command to count active DHCP leases



  • Hi all,
    I want to get the number of active DHCP leases. E.g: The DHCP IPs that clients are using and the DHCP server can't not reclaim yet.

    I use the following command. But it seems not accurate yet.
    grep active /var/dhcpd/var/db/dhcpd.leases | wc -l

    Any idea?
    Thanks a lot.


  • LAYER 8 Global Moderator

    If your wanting to keep an eye on the number of leases your using and such.. I would think you would want to turn on the graphing feature for dhcp.

    Or if you just go to status leases, at the bottom you can get a count from each dhcp pool - is that what your looking for?




  • Normally, I only access pfsense remotely.
    Nevermind, I will see the code in the page you suggest and figure out how to count in batch shell.
    Thanks a lot.


Log in to reply