NethServer / nethsecurity

NethSecurity image and build environment
https://www.nethsecurity.org/
Other
82 stars 5 forks source link

DHCP server won't assign ip after migration #585

Closed francio87 closed 1 week ago

francio87 commented 3 weeks ago

After migrating from version 7.9 to version 8, if there were no DHCP servers enabled in version 7, the DHCP server in version 8 does not assign IP addresses even if enabled.

Steps to reproduce

Expected behavior

DHCP server give out IP address to clients

Actual behavior

The server recive the DHCP and after an initial offer it reply with a NAK and the message no leases left

Jun 11 17:44:24 xxxx dnsmasq-dhcp[1]: DHCPDISCOVER(eth0) 98:xx:xx:xx:xx:x
Jun 11 17:44:24 xxxx dnsmasq-dhcp[1]: DHCPOFFER(eth0) 192.168.1.212 98:xx:xx:xx:xx:x
...
...
Jun 11 17:44:30 xxxx dnsmasq-dhcp[1]: DHCPNAK(eth0) 192.168.1.212 98:xx:xx:xx:xx:xx no leases left
Jun 11 17:44:30 xxxx dnsmasq-dhcp[1]: DHCPNAK(eth0) 192.168.1.212 98:xx:xx:xx:xx:xx no leases left

Looking at the uci configuration this option get set under the dhcp configuration :

option dhcpleasemax '0'

The export.tar.gz file, has inside the dhcp.json file :

{"general":{"dhcpleasemax":0,"rebind_protection":"0"},"reservations":[],"servers":[]}

Removing the option dhcpleasemax solve the issue:

root@test-ns8:~# diff -u /tmp/dhcp /etc/config/dhcp
--- /tmp/dhcp   2024-06-12 12:25:26.000000000 +0200
+++ /etc/config/dhcp    2024-06-12 15:54:12.432474929 +0200
@@ -20,7 +20,6 @@
        option ednspacket_max '1232'
        option filter_aaaa '0'
        option filter_a '0'
-       option dhcpleasemax '0'
        option enable_tftp '1'
        option allservers '1'
        option logqueries '0'
filippocarletti commented 3 weeks ago

I think we can ignore the size of the DHCP pool. Or handle the value 0 as a special case. A default clean installation of version 8 doesn't set dhcpleasemax.

gsanchietti commented 2 weeks ago

Testing image: 23.05.3-ns.1.0.1-12-g33ff78b

francio87 commented 2 weeks ago

Confirm, fixed. Tested with the same export file, the value dhcpleasemax it's not present anymore :

root@ns79-mig:~# uci show dhcp |grep dhcpleasemax
root@ns79-mig:~#