DHCPd how to Remove expired leases



  • Hello all,

    for low-end system there should an option, to remove all expired DHCP leases from its Lease file.

    background. i've had configured a class B net like 172.16.0.0/16 DHCP Range from 1.1 to 255.254 The Lease files grows up to 360000 lines and the DHCP server acts painfully slow,  and makes duplicate records like this:

    
    lease 172.27.247.204 {
      starts 2 2015/03/10 15:49:48;
      ends 2 2015/03/10 16:19:48;
      cltt 2 2015/03/10 15:49:48;
      binding state active;
      next binding state free;
      rewind binding state free;
      hardware ethernet dc:9b:9c:cb:13:0d;
      uid "\001\334\233\234\313\023\015";
      client-hostname "XXXA";
    }
    
    lease 172.27.247.204 {
      starts 2 2015/03/10 15:50:51;
      ends 3 2015/03/11 15:50:51;
      cltt 2 2015/03/10 15:50:51;
      binding state active;
      next binding state free;
      rewind binding state free;
      hardware ethernet dc:9b:9c:cb:13:0d;
      uid "\001\334\233\234\313\023\015";
      client-hostname "XXXA";
    }
    lease 172.27.247.204 {
      starts 2 2015/03/10 15:50:52;
      ends 2 2015/03/10 16:20:52;
      cltt 2 2015/03/10 15:50:52;
      binding state active;
      next binding state free;
      rewind binding state free;
      hardware ethernet dc:9b:9c:cb:13:0d;
      uid "\001\334\233\234\313\023\015";
      client-hostname "XXXA";
    }
    lease 172.27.250.254 {
      starts 2 2015/03/10 15:50:53;
      ends 3 2015/03/11 15:50:53;
      cltt 2 2015/03/10 15:50:53;
      binding state active;
      next binding state free;
      rewind binding state free;
      hardware ethernet c8:e0:eb:8e:f7:6c;
      uid "\001\310\340\353\216\367l";
      client-hostname "XXXB-iPhone";
    }
    lease 172.27.250.254 {
      starts 2 2015/03/10 15:50:54;
      ends 2 2015/03/10 16:20:54;
      cltt 2 2015/03/10 15:50:54;
      binding state active;
      next binding state free;
      rewind binding state free;
      hardware ethernet c8:e0:eb:8e:f7:6c;
      uid "\001\310\340\353\216\367l";
      client-hostname "XXXB-iPhone";
    }
    

    i stopped the server and trashed the lease files and shinked the pool for now…

    best regards

    Dave



  • Do you really need an address space / DHCP scope that has over 65,500 possible hosts?


  • LAYER 8 Netgate

    It's just doing what you've told it to do.  Reduce your subnet size if you don't want it that big (or at least the DHCP Server's pool).


Log in to reply