<html><head>    

    
          <style type="text/css" title="rt_noDelete">
    blockquote.rt {
    margin: 0 0 15px;
    border-left: 4px solid #81c784;
    padding: 0 0 0 12px;
    display: block;
    }
    p { margin: 0 0 0 0 }
.email-signature {font-family:"Arial"; font-size: 8pt; font-style: italic; font-weight: normal; text-decoration: none; }
    </style></head><body><p class="norm">You can stop the dhcpd server and edit the leases file and remove the lease.</p><p> </p><p class="norm">That doesn't follow the RFC for how leases are handled, and if you have a ddns entry that was generated by the lease, it won't get removed.</p><p class="norm">There are probably other undesirable side-effects I can't think of at the moment too.</p><p class="norm"> </p><p class="norm">You'll also need to make sure that client doesn't continue to attempt to use the lease it was promised, and hasn't expired yet. Different clients handle that differently.</p><p> </p><p class="norm">But you're breaking the rules for dhcpd leases, so you have to work around those problems.</p><p> </p><p>I think that answers your question - but it perhaps misses the more important factor of "Why?"</p><p>Why are you wanting to delete a lease? (One off mistake, and you'll handle the fallout? Probably fine. You want to do this systemically? Quite ugly with lots of complications.)</p><p> </p><p>There's been a lot of discussion on the list over the years about admins wanting to force all leases to get new IP's at expiration, cause them to end early etc. And there's a lot of reasons those ideas are often bad - some more bad than others. Thus, knowing what you're trying to accomplish might help us offer more than a set of steps to do what you asked, and more along the lines of "Is this a good idea that has practical merit?" (Probably not, but it might be worth some consideration.) :)</p><p class="norm"><br/></p><p class="norm">
-Greg</p><p> </p><p class="norm"><br/></p><p class="norm"></p><blockquote class="rt">
    <p>Hi, community,</p>
    <p>I want to delete a lease, for example, this one below instead of
      waiting eight hours. What is the correct way to do it? I mean, I
      do not want to screw the DHCP service up. So, could someone give
      me some advice to approach this task? Thanks a lot.</p>
    <p>
      </p><blockquote type="cite"><span style="color: rgb(0, 0, 0); &#xA;&#xA;          font-family: Inconsolata, monospace; font-size: 16.64px; &#xA;&#xA;          font-style: normal; font-variant-ligatures: normal; &#xA;&#xA;          font-variant-caps: normal; font-weight: 400; letter-spacing: &#xA;&#xA;          0.15px; orphans: 2; text-align: start; text-indent: 0px; &#xA;&#xA;          text-transform: none; white-space: normal; widows: 2; &#xA;&#xA;          word-spacing: 0px; -webkit-text-stroke-width: 0px; &#xA;&#xA;          background-color: rgb(255, 255, 255); &#xA;&#xA;          text-decoration-thickness: initial; text-decoration-style: &#xA;&#xA;          initial; text-decoration-color: initial; display: inline &#xA;&#xA;          !important; float: none;">/var/lib/dhcp/dhcpd.leases</span></blockquote>
    
    <p>
      </p><blockquote type="cite">lease DIR-IP-X.X.X.X {<br/>
          starts 3 2022/06/08 10:42:28;<br/>
          ends 3 2022/06/08 18:42:28;<br/>
          tstp 3 2022/06/08 18:42:28;<br/>
          cltt 3 2022/06/08 10:42:28;<br/>
          binding state active;<br/>
          next binding state free;<br/>
          rewind binding state free;<br/>
          hardware ethernet DIR-MAC-X:X:X:X;<br/>
          uid "\001\304\015\2264\243\376";<br/>
          set agent-id = "DIR-IP-X.X.X.X";<br/>
          set hstnm = "EG8145X6";<br/>
          set clhw = "DIR-MAC-X:X:X:X";<br/>
          set clip = "DIR-IP-X.X.X.X";<br/>
          set cllt = "28800";<br/>
          set hsttype = "pc";<br/>
          set tech = "gpon";<br/>
          set clrid = "34:38:35:37:35:34:34:33:44:33:42:46:45:31:41:37";<br/>
          set clcid =
"4d:41:44:52:49:44:5f:30:31:20:78:70:6f:6e:20:30:2f:31:31:2f:30:2f:31:33:3a:34:2e:32:2e:32:30:30:25";<br/>
          option agent.circuit-id "XXXXX_01 xpon 0/11/0/13:4.2.200%";<br/>
          option agent.remote-id "48575443D3BFE1A7";<br/>
          client-hostname "EG8145X6";<br/>
          on expiry {<br/>
            set clip =<br/>
               binary-to-ascii (10, 8, ".", leased-address) ;<br/>
            execute ("/opt/fos/bin/push_ip_lease",
        "--transaction=expiry",<br/>
                concat ("--leased-address=", clip));<br/>
          }<br/>
          on release {<br/>
            set clip =<br/>
               binary-to-ascii (10, 8, ".", leased-address) ;<br/>
            execute ("/opt/fos/bin/push_ip_lease",
        "--transaction=release",<br/>
                concat ("--leased-address=", clip));<br/>
          }<br/>
        }<br/>
      </blockquote>
      Best,<br/>
    
  </blockquote><div class="email-signature"><br/>
</div></body>