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

    Convenience hack: add description to DHCP clients

    Scheduled Pinned Locked Moved DHCP and DNS
    1 Posts 1 Posters 232 Views 1 Watching
    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.
    • F Offline
      Fry-kun
      last edited by

      I have some devices on my network that I don't easily recognize from the MAC and the host doesn't set client-hostname. Normally I'd have to add a static IP mapping to keep track of these. It's allowed to not specify an IP, but that doesn't map to the live devices..
      Anyway, I added a patch below to system.inc to show the description next to live lease info.
      It's kinda hacky but works for me :)

      --- /etc/inc/system.inc	2021-02-08 04:44:12.000000000 -0800
      +++ /etc/inc/system.inc	2021-07-09 22:11:17.158591000 -0700
      @@ -844,6 +844,14 @@
       				continue;
       			}
       
      +			// Add static description to leases
      +			foreach($leases['lease'] as &$ksl) {
      +				if ($ksl['mac'] == $static['mac']) {
      +					$ksl['descr'] = $static['descr'];
      +					break;
      +				}
      +			}
      +
       			$slease = array();
       			$slease['ip'] = $static['ipaddr'];
       			$slease['type'] = $static_string;
      

      Note: both the static entry & live lease info will show up in the leases table

      Hope this helps someone

      1 Reply Last reply Reply Quote 0
      • First post
        Last post
      Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.