negan07 / ancistrus

Netgear's D7000 Nighthawk Router Experience Distributed Project
https://negan07.github.io/ancistrus/
GNU General Public License v2.0
66 stars 17 forks source link

How to change DHCP lease time #77

Closed giga89 closed 3 years ago

giga89 commented 3 years ago

Hi to all! Is there a parameter to change this value? Thx a lot

negan07 commented 3 years ago

the router uses a modified version of udhcp-0.9.7 options are generated into: /etc/udhcpd.conf[1-8] where [1-8] are the vlan id if any (typically 1 is the number)

root@D7000:/$ cat /etc/udhcpd.conf1
server      10.0.0.1
start       10.0.0.11
end     10.0.0.50
interface   group1
group_id    1
option  subnet  255.255.255.0
option  router  10.0.0.1
option  dns 10.0.0.1
option  lease   86400

the lease related option is the last option lease 86400 configured with a fixed value of 24hours

Considering a single vlan (id 1), a possible workaround to modify it could be (and it must be tested):

rc_dhcpd stop
rc_dhcpd create 1
ln -sf /usr/sbin/udhcpd /var/udhcpd_1
sed -i "s|86400|13333|" /etc/udhcpd.conf1
/var/udhcpd_1 /etc/udhcpd.conf1 &
giga89 commented 3 years ago

Hi Negan, first of all: you are awesome. I solved with your commands Thank u, happy life

negan07 commented 3 years ago

thank you too

In truth this is a dirty workaround, to be reapplied at every code restart, so take care expecially on cronjobs or wan reconnections