OPNsense Forum

Archive => 22.1 Legacy Series => Topic started by: bubbagump on March 15, 2022, 02:14:34 pm

Title: Unbound seemingly never removes stale DHCP records
Post by: bubbagump on March 15, 2022, 02:14:34 pm
Running 22.1.2_1. Seemingly Unbound never deletes/cleans up A records created by DHCP. As an example and how I can reproduce it - I spin up a new VM and it uses DHCP in its initial boot. Once it boots the first time, I create a static reservation and refresh the lease on the VM to use the new IP reservation. Now Unbound reports the original IP and the new reservation IP. Fast forward a few days and the original DHCP lease which has long expired literally days ago is still being served by Unbound along with the reservation IP. No amount of service restarts or reboots cleans it up. Is this a bug? By design and I am missing a config option? Something else?

EDIT: Ignore me... somehow the default lease time was set to a WEEK. Well, that explains that. It was a DHCP issue and not Unbound as when I deleted the entries from /var/unbound/dhcpleases.conf, they would reappear when I restarted Unbound. That was my clue. I r dum.
Title: Re: Unbound seemingly never removes stale DHCP records
Post by: devhunter55 on March 15, 2022, 03:01:48 pm
what is your TTL for Host cache entries ?

(Time to live for entries in the host cache. The host cache contains roundtrip timing and EDNS support information. The default is 15 minutes. )
Title: Re: Unbound seemingly never removes stale DHCP records
Post by: bubbagump on March 15, 2022, 03:04:13 pm
Thank you, but see my edit above... somehow the DHCP lease time was set to a week. (I think I know how this happened - someone trying to match Windows DHCP defaults... grumble.)
Title: Re: Unbound seemingly never removes stale DHCP records
Post by: franco on March 15, 2022, 03:38:03 pm
Did you know: the reference file for Unbound's DHCP watcher is /var/dhcpd/var/db/dhcpd.leases and this is operated by DHCPd alone. Of course you can edit the file yourself if you really need to purge a lease although it might not convince the client to give it up either.  :)


Cheers,
Franco
Title: Re: Unbound seemingly never removes stale DHCP records
Post by: bubbagump on March 15, 2022, 03:43:25 pm
Thanks, yup, I tracked that down and see how the plumbing connects now.