OPNsense Forum

Archive => 21.1 Legacy Series => Topic started by: Asperamanca on February 21, 2021, 05:07:11 PM

Title: DHCP: Any way to set maximum lease time to "infinite" for static mappings?
Post by: Asperamanca on February 21, 2021, 05:07:11 PM
So the default lease time is one day, even for statically mapped IP addresses. I understand now why my Wifi AP complains once a day that is was disconnected  :)

The ugly solution is to enter a ridiculously high value (2^31 comes to mind, since I don't know whether the value is stored signed or unsigned). As an engineer, this solution is not very satisfying. Is there a default "disable maximum lease time" option?
Title: Re: DHCP: Any way to set maximum lease time to "infinite" for static mappings?
Post by: chemlud on February 21, 2021, 06:30:31 PM
https://lazyadmin.nl/home-network/dhcp-lease-time/
Title: Re: DHCP: Any way to set maximum lease time to "infinite" for static mappings?
Post by: Asperamanca on February 28, 2021, 02:54:25 PM
Interesting. Since I upped the maximum lease time, I no longer my Wifi AP's "device has been disconnected" error once every 24 hours.
Seems like not every device knows it needs to renew the lease...
Title: Re: DHCP: Any way to set maximum lease time to "infinite" for static mappings?
Post by: Maurice on February 28, 2021, 07:00:42 PM
I've seen this once with a certain Cisco switch. It never renewed its DHCP lease. After the lease expired, the switch was left without an IP address and the management interface became unreachable.
Workaround: One year lease time. ;D

Regarding infinite leases: Setting default-lease-time / max-lease-time in the dhcpd.conf to -1 should have this effect. But I'm not sure whether the OPNsense UI allows this.
Title: Re: DHCP: Any way to set maximum lease time to "infinite" for static mappings?
Post by: Asperamanca on February 28, 2021, 09:03:19 PM
The maximum setting that fits into a 32bit signed int is more than 60 years. That should do. I also only set this to specific static leases where I encounter these problems.