DHCP Lease Reservation not deleted when host is deleted

Problem:
So, I read from here that when a host is deleted, the reservation within the lease file would be “deleted” by appending this into the lease file":
host test1.nested.lan {
dynamic;
deleted;
}
The issue is that when I delete the host, and restarted the DHCPD service, the leases are squashed but I do not see the above segment, while the reservation of the host is still there.
Expected outcome:
The reservation for the host should be “deleted” when I delete the host

Foreman and Proxy versions:
2.14
Foreman and Proxy plugin versions:
2.14
Distribution and version:

Other relevant data:

Please pastebin the lease file before and after the restart.

Also the proxy.log would be helpful to see, if the request was sent from Foreman to Smart Proxy

After Discovering:
lease 10.72.37.236 {
starts 5 2021/06/18 01:30:00;
ends 5 2021/06/18 13:30:00;
cltt 5 2021/06/18 01:30:00;
binding state active;
next binding state free;
rewind binding state free;
hardware ethernet [HOST-MAC-ADDR];
set vendor-string = “PXEClient:Arch:00007:UNDI:003001”;
}
lease 10.72.37.236 {
starts 5 2021/06/18 01:31:47;
ends 5 2021/06/18 13:31:47;
cltt 5 2021/06/18 01:31:47;
binding state active;
next binding state free;
rewind binding state free;
}

After Provisioning:
lease 10.72.37.236 {
starts 5 2021/06/18 01:30:00;
ends 5 2021/06/18 13:30:00;
cltt 5 2021/06/18 01:30:00;
binding state active;
next binding state free;
rewind binding state free;
hardware ethernet [HOST-MAC-ADDR];
set vendor-string = “PXEClient:Arch:00007:UNDI:003001”;
}
lease 10.72.37.236 {
starts 5 2021/06/18 01:31:47;
ends 5 2021/06/18 13:31:47;
cltt 5 2021/06/18 01:31:47;
binding state active;
next binding state free;
rewind binding state free;
}
host mac[HOST-MAC-ADDR].domain.com {
dynamic;
hardware ethernet [HOST-MAC-ADDR];
fixed-address 10.72.37.236;
supersede server.filename = “grub2/grubx64.efi”;
supersede server.next-server = [SERVER-IP];
supersede host-name = “mac[HOST-MAC-ADDR].domain.com”;
}
lease 10.72.37.236 {
starts 5 2021/06/18 01:31:47;
ends 5 2021/06/18 02:15:16;
tstp 5 2021/06/18 02:15:16;
cltt 5 2021/06/18 01:31:47;
binding state free;
hardware ethernet [HOST-MAC-ADDR];
}

After deleting host from Foreman and restarting dhcpd:Preformatted text
host mac[HOST-MAC-ADDR].domain.com {
dynamic;
hardware ethernet [HOST-MAC-ADDR];
fixed-address 10.72.37.236;
supersede server.filename = “grub2/grubx64.efi”;
supersede server.next-server = [SERVER-IP];
supersede host-name = “mac[HOST-MAC-ADDR].domain.com”;
}
lease 10.72.37.236 {
starts 5 2021/06/18 01:31:47;
ends 5 2021/06/18 02:15:16;
tstp 5 2021/06/18 02:15:16;
cltt 5 2021/06/18 01:31:47;
binding state free;
hardware ethernet [HOST-MAC-ADDR];
}

proxy.log:

[I] Started DELETE /dns/236.37.72.10.in-addr.arpa
[I] Finished DELETE /dns/236.37.72.10.in-addr.arpa with 200
[I] Started GET /tftp/serverName
[I] Finished GET /tftp/serverName with 200
[I] Started DELETE /dhcp/[SERVER-IP]/mac/[HOST-MAC-ADDR]
[I] Finished DELETE /dhcp/[SERVER-IP]/mac/[HOST-MAC-ADDR] with 200
[I] Started DELETE /tftp/PXELinux/[HOST-MAC-ADDR]
[I] Finished DELETE /tftp/PXELinux/[HOST-MAC-ADDR] with 200
[I] Started DELETE /tftp/PXEGrub2/[HOST-MAC-ADDR]
[I] Finished DELETE /tftp/PXEGrub2/[HOST-MAC-ADDR] with 200
[I] Started DELETE /tftp/PXEGrub/[HOST-MAC-ADDR]
[I] Finished DELETE /tftp/PXEGrub/[HOST-MAC-ADDR] with 200
[I] Started DELETE /tftp/iPXE/[HOST-MAC-ADDR]
[I] Finished DELETE /tftp/iPXE/[HOST-MAC-ADDR] with 200

I only include the part of the proxy.log that had to do with the deletion of the host.
Sorry I could not reveal some details. Hope it is clear.
Also, SERVER-IP refers to the Foreman server, which is also the DHCP Smart Proxy Server, DHCP server and DNS server.

At which point do you restart the dhcp server and also, why do you restart it?

After you perform provisioning but before you restart it, do you see the “deleted” entry?

I haven’t seen this before.

After provisioning but before I restart it, I do not see the “deleted” entry.
The reason I restarted it was because when I deleted the host, the reservation was still there, and so I manually removed the reservation from the lease file and restarted the service.
Also because the link in the original post said that restarting the service might make the “deleted” entry appear.

It is hard to figure it out since you replaced subnet ip with SERVER-IP. My guess is you probably have an incorrect subnet address, can you check that? Also increase logging to DEBUG of the /etc/foreman-proxy and try again, that should give us more insigt. You can also PM me unchanged logs if you do not want to share it here (btw you already leaked the IP address.

Sorry which subnet address are you referring to?

Here in the URL the SERVER-IP is supposed to be subnet IP.

The SERVER-IP is actually 10.72.37.51, which is also the IP for my Foreman server. Is this wrong?

That is incorrect, this should be subnet IP. You define this address when creating new Subnet in Foreman and it must be a valid subnet address. Example:

  • 192.168.42.0/24

(Foreman only sends the address part without prefix.)

If you do get this incorrectly, then Smart Proxy processes it however DHCP server than is unable to find the record.

TLDR - Show me a screenshot of the Subnet edit page.

Sorry the Foreman server is on another network and I have no methods of screenshotting the Subnet page. So my subnet is 10.72.37.0/24. I can’t put 10.72.37.51/24? I assumed that since only the first 24 bits are important it doesnt not matter if I put 0 or 51 for the last octet. So I need to put 0?

Yes you do need to put zeroes, in fact, we are working on a validation that will require you to do so to prevent this.

Symptoms are a bit hard to troubleshoot because ISC DHCP somehow creates records but fails to delete them. Weird.

We see this again @ekohl and @evgeni !

It worked! Thanks!

1 Like

Comment in the PR would help to get it merged (hopefully :slight_smile: