this post was submitted on 28 Jan 2025
6 points (100.0% liked)
networking
2932 readers
1 users here now
Community for discussing enterprise networks and the ensuing chaos that comes after inheriting or building one.
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
The thing with a cron job is that it would likely be every minute at best.
If I connect at 20:25:01 and I have to wait 59 seconds for the next cron pass, it'll probably be noticeable and annoying.
I haven't done pfsense in a while but it shouldn't be too complicated.
I think they still use ISC DHCP? If so, I vaguely remember you could use hooks or something event based instead of checking for leases every x time.
Something like this in dhcpd.conf:
Now... bringing it down is generally less "urgent" and a cron job that checks the number of leases would be fine. Being more instantaneous in bringing it up but taking your time to bring in down would be beneficial and introduce some sort of hysteresis so it flaps less.
To my frustration, I've tried both your method with ISC and a run_script hook with Kea, and pfsense just overwrites the custom configs. There's a PR on their github but it's been sitting there for months.
Well that's annoying.
You could probably read the file where it writes the leases instead. Although that isn't event based unless you do your own wrapper to check it every second instead of cronus minutes