Need to Increase 50 Static DHCP Lease Limit

It appears that I'm only able to have 50 static DHCP leases and I was wondering if anyone knew how to increase this limit. I'm not sure if the issue is with LuCi/UCI or Dnsmasq.

When I have 50 static leases and press the 'Add' button in the web UI, LuCi throws an error "Some fields are invalid, cannot save values!"

If I try to use a 'uci set' command at an SSH shell to add a 51st, UCI throws the error, "uci: Invalid argument"

I have tried manually editing /etc/config/dhcp to include 51 static leases and unfortunately it breaks LuCi because it no longer displays anything in the DHCP section.

I am running a davidc502 OpenWRT build dated 2018-11-30 for a WRT1900ACv1.

Thanks in advance.

If you don't get an answer as to how to manage this with dnsmasq, you might want to look into kea, which is designed to scale for enterprise use. It can be run with a flat-file, (without a formal database). Recent versions support high-availability with various fail-over modes.

There is no such limit, I have roughly 270 static DHCP reservations.

1 Like

Thank you for the replies. I'd rather not migrate away from dnsmasq and use kea, the davidc502 builds I use natively have dnsmasq packaged and I feel like I'd be adding a lot of complexity for one feature.

@slh - In order to get to 270 did you do anything special? What build are you using or did you roll your own? I definitely cannot create 51+ static leases with the davidc502 build I am using at either the Rosy LuCi interface or the UCI command line.

Like I mentioned above, editing the /etc/config/dhcp file breaks LuCi's DHCP display (the section becomes blank). But one thing I hadn't explored was whether it actually worked. In other words, 51+ static leases may not be possible to be managed with LuCi/UCI, I'll just need to vi my edits moving forward. I'll give this a try in a few days.

Thanks again.

All,

  • OpenWrt configures LAN to issue up to 150 IPs via DHCP, this can be increased here (please be aware you cannot issue a number above 254 on a /24 network, so you will have to adjust your Start IP accordingly):

Screenshot%20from%202018-12-17%2010-20-37

I obviously use larger subnets than /24 and I do regularly build master snapshots myself, but I don't configure anything special (neither for the build- nor runtime configuration).

1 Like

See below for my settings for DHCP within my LAN interface which is on a 24 bit netmask (i.e. - 10.0.0.128 - 10.0.0.254).

image

Here is a look at the first part of my /etc/config/dhcp file (omitting the 50 'config host' entries):

config dnsmasq                                                                                                                                                                     
        option localise_queries '1'                                                                                                                                                
        option rebind_protection '1'                                                                                                                                               
        option rebind_localhost '1'                                                                                                                                                
        option expandhosts '1'                                                                                                                                                     
        option authoritative '1'                                                                                                                                                   
        option readethers '1'                                                                                                                                                      
        option leasefile '/tmp/dhcp.leases'                                                                                                                                        
        option nonwildcard '1'                                                                                                                                                     
        option localservice '1'                                                                                                                                                    
        option local '/gooch.net/'                                                                                                                                                 
        option domain 'gooch.net'                                                                                                                                                  
        option noresolv '1'                                                                                                                                                        
        option domainneeded '1'                                                                                                                                                    
        option cachesize '300'                                                                                                                                                     
        option enable_tftp '1'                                                                                                                                                     
        option tftp_root '/mnt/sda1/tftp'                                                                                                                                          
        option dhcp_boot 'pxelinux.0'                                                                                                                                              
        list server '/pool.ntp.org/8.8.8.8'                                                                                                                                        
        list server '127.0.0.1#5300'                                                                                                                                               
                                                                                                                                                                                   
config dhcp 'lan'                                                                                                                                                                  
        option interface 'lan'                                                                                                                                                     
        option leasetime '12h'                                                                                                                                                     
        option start '128'                                                                                                                                                         
        option limit '127'                                                                                                                                                         
                                                                                                                                                                                   
config dhcp 'wan'                                                                                                                                                                  
        option interface 'wan'                                                                                                                                                     
        option ignore '1'                                                                                                                                                          
                                                                                                                                                                                   
config odhcpd 'odhcpd'                                                                                                                                                             
        option maindhcp '0'                                                                                                                                                        
        option leasefile '/tmp/hosts/odhcpd'                                                                                                                                       
        option leasetrigger '/usr/sbin/odhcpd-update'                                                                                                                              
        option loglevel '4'      

And below is the LuCi error I receive when I click the 'Add' button under Network > DHCP and DNS:

image

:man_facepalming:

128 + 127 = 255

The last 255 IP is invalid as a network with broadcast addressing. It is the broadcast IP.

option limit '126'

The start is 128, and so it's actually:

127 + 127 = 254

If the start is 128, then 128 is included in the count.

I don't believe anything would be impacted unless the 10.0.0.255 lease were to be given to a DHCP client, although I could be wrong.

I'm not sure if you're asking a question, or missing math.

If I missed you, yes, 128 is counted.

@lleachii - No, not asking a question. Just attempting to show that this config isn't the problem and my math is correct.

I verified on an Excel spreadsheet that if I start at 128 and use 127 leases then the highest lease that would be given is 10.0.0.254 (screen shot below). I don't think this is my problem. Thank you for your help so far.

image

And here is the top part. I'm a new user so I can only post 1 image per post.

image

:+1:

I'm not sure how Excel relates to OpenWrt. I hope you find the solution.

I used Excel to display visually that my DHCP range is set for 10.0.0.128 - 10.0.0.254, and that block is 127 addresses. It does not include 10.0.0.255 and so I do not need to lower the option to 126 as suggested. Off-by-one, because it is not additive to 10.0.0128, it includes 10.0.0.128.

I'm starting to think this may be specific to the davidc502 build I am using. From everyone's comments and my Google searches there isn't any setting for this or dnsmasq limitation.

Hi everyone, I've found a workaround.

Like I mentioned above I can edit the /etc/config/dhcp and add the 51st and above entries but it breaks LuCi (displays nothing in the web GUI). However, it works and hands out the correct static entries, I've currently got 54 working properly (not that that's huge like the 270 @slh has, it's just more than 50).

I'll just have to manage my static entries from the file via vi. Thanks everyone for your suggestions.

If your subnet is 10.0.0.128/255.255.255.128, you just have 126 ip block for dhcp. Because 10.0.0.128 is a subnet ID, 10.0.0.255 is a broadcast address. The router ip cannot set as subnet ID, subID & broadcast address can't use in dhcp block, that's mean 255-128=127-routerip=126.
Btw, I don't know what subnet mask you are using ? What ip address of router ?

The subnet is 10.0.0.0/24 and my br-lan interface is 10.0.0.1. My DHCP scope is 10.0.0.128-254.

I'm try reproduce your issue but no success.
I added more than 50 static entry by luci gui without errors.
Screenshot_2018-12-23%20erlite%20-%20DHCP%20and%20DNS
Screenshot_2018-12-23%20erlite%20-%20DHCP%20and%20DNS%20-%20LuCI

@gooch - Given that you suspect that the problem may have something to do with the davidc502 builds, have you considered flashing a release build (18.06.1) directly from OpenWrt?