SNMP: get list of DHCP leases



  • In version 1.2.3 it was possible to get the DHCP leases by running the ipNetToMediaPhysAddress command.
    Now in my test environment (version 2.0 RC3) this result remains empty.

    Also I noted that a lot of other SNMP data is not available in the 2.0 version.

    The list in version 1.2.3 looked like:
    1 IP-MIB::ipNetToMediaPhysAddress.2.10.0.10.1 = STRING: 0:c:f6:3a:14:5b
    2 IP-MIB::ipNetToMediaPhysAddress.21.10.0.50.1 = STRING: 0:24:8c:19:fb:d0
    3 IP-MIB::ipNetToMediaPhysAddress.22.10.0.60.1 = STRING: 40:4a:3:9c:8f:ca
    4 IP-MIB::ipNetToMediaPhysAddress.23.10.0.30.1 = STRING: 0:1f:9f:6:fa:2f
    5 IP-MIB::ipNetToMediaPhysAddress.24.10.0.40.1 = STRING: 40:4a:3:9c:8d:9a
    6 IP-MIB::ipNetToMediaPhysAddress.25.10.0.20.1 = STRING: 0:23:54🅱b1:bf
    7 IP-MIB::ipNetToMediaPhysAddress.26.10.10.0.11 = STRING: 0:e:a6:c8:5c:f8
    8 IP-MIB::ipNetToMediaPhysAddress.26.10.10.0.12 = STRING: 0:c:f6:5c:93:6c

    I also tried to get it by the atPhysAddress command (cisco like), but also the result remained empty.
    When I get all the available SNMP info, this also indicates that I can get a SNMP result, there is no data to be found about the DHCP leases.

    I have the following modules available and selected in pfSense:
    SNMP Modules MibII
    Netgraph
    PF
    Host Resources (Requires MibII)

    Is it possible to get a list like this in 2.0 RC3?



  • Created a work around:
    Since the SNMP data was requested by an external webserver, it is also possible to get some webpage info through this php webserver.

    Created to following script on pfSense /usr/local/www/dhcpDump.php

    $dhcpFile = file_Get_contents('/var/dhcpd/var/db/dhcpd.leases');
    echo nl2br($dhcpFile);
    ?>
    
    

    Then created a NAT rule for only my webserver's IP address to access the pfSense portal. (E.g. https://pfsenseAddress:7000/dhcpDump.php)

    Got in this dump a lot of usefull info to work with.
    Hope it helps others as well.

    Best regards,
    Tim


Locked