• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

Command to count active DHCP leases

Scheduled Pinned Locked Moved DHCP and DNS
3 Posts 2 Posters 4.9k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M
    Mypfsense2016
    last edited by Jan 9, 2017, 10:22 AM

    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.

    1 Reply Last reply Reply Quote 0
    • J
      johnpoz LAYER 8 Global Moderator
      last edited by Jan 9, 2017, 4:19 PM

      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?

      leases.jpg
      leases.jpg_thumb

      An intelligent man is sometimes forced to be drunk to spend time with his fools
      If you get confused: Listen to the Music Play
      Please don't Chat/PM me for help, unless mod related
      SG-4860 24.11 | Lab VMs 2.7.2, 24.11

      1 Reply Last reply Reply Quote 0
      • M
        Mypfsense2016
        last edited by Jan 10, 2017, 12:09 AM

        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.

        1 Reply Last reply Reply Quote 0
        2 out of 3
        • First post
          2/3
          Last post
        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
          This community forum collects and processes your personal information.
          consent.not_received