Setting Static IP (Leases) LuCI 23.05

Good Evening

I am trying to set a static leas for devices on the network. I want to do this using the web interface.

Specifics:

  • OpenWrt Version 23.05.3
  • LuCI Version 23.05

I have tried the following:
Network -> Interfaces -> lan[edit] -> DHCP Server

My Router is at 10.0.0.1
I have set the Start to 5 (wanting 10.0.0.5)
I have set Limit to 150 (assuming 10.0.0.5 - 10.0.0.155)
Save and Save/Apply

Then...
Network -> DHCP and DNS -> Static Leases -> Add
Complete the Fields
I always get the error in IPv4 address:
"The IP address is outside of any DHCP pool address range"

For context I am trying to set the device to 10.0.0.50.

I am looking for how to properly set-up/fix this using the web interface.

Thank You

Your static DHCP reservations should be outside the dynamic DHCP pool (should, not strict must - so >=156).

2 Likes

Thank you for the reply. I attempted to fix by setting the static lease to 10.0.0.180. I am presented with same error message.

Still working on this…could it be a bug? Either the function or the error message, sending me in the wrong direction?

Please connect to your OpenWrt device using ssh and copy the output of the following commands and post it here using the "Preformatted text </> " button:
grafik
Remember to redact passwords, MAC addresses and any public IP addresses you may have:

ubus call system board
cat /etc/config/network
cat /etc/config/dhcp
 _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt 23.05.3, r23809-234f1a2efa
 -----------------------------------------------------
root@OpenWrt:~# ubus call system board
{
        "kernel": "5.15.150",
        "hostname": "OpenWrt",
        "system": "ARMv7 Processor rev 5 (v7l)",
        "model": "Linksys EA8300 (Dallas)",
        "board_name": "linksys,ea8300",
        "rootfs_type": "squashfs",
        "release": {
                "distribution": "OpenWrt",
                "version": "23.05.3",
                "revision": "r23809-234f1a2efa",
                "target": "ipq40xx/generic",
                "description": "OpenWrt 23.05.3 r23809-234f1a2efa"
        }
}
root@OpenWrt:~# cat /etc/config/network

config interface 'loopback'
        option device 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix ''

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'lan1'
        list ports 'lan2'
        list ports 'lan3'
        list ports 'lan4'

config device
        option name 'lan1'
        option macaddr '7'

config device
        option name 'lan2'
        option macaddr ''

config device
        option name 'lan3'
        option macaddr ''

config device
        option name 'lan4'
        option macaddr ''

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option ipaddr '10.0.0.1'
        option netmask '255.255.255.0'
        option ip6assign '60'
        list dns '10.0.0.2'
        option delegate '0'

config device
        option name 'wan'
        option macaddr 

config interface 'wan'
        option device 'wan'
        option proto 'dhcp'
        option peerdns '0'
        list dns '10.0.0.2'

root@OpenWrt:~# cat /etc/config/dhcp

config dnsmasq
        option domainneeded '1'
        option localise_queries '1'
        option rebind_protection '1'
        option rebind_localhost '1'
        option local '/lan/'
        option domain 'lan'
        option expandhosts '1'
        option cachesize '1000'
        option readethers '1'
        option leasefile '/tmp/dhcp.leases'
        option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
        option localservice '1'
        option ednspacket_max '1232'

config dhcp 'lan'
        option interface 'lan'
        option start '10.0.0.5'
        option limit '150'
        option leasetime '12h'
        option dhcpv4 'server'
        option ignore '1'
        option dynamicdhcp '0'

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'


Change the start to 5 and remove the ignore line. It should look like this:

config dhcp 'lan'
        option interface 'lan'
        option start '5'
        option limit '150'
        option leasetime '12h'
        option dhcpv4 'server'
        option dynamicdhcp '0'

Then restart your device and try adding your static lease again.

Also remove that. Setting to 0 prevents assignment of pool addresses ("random" between start and start+limit) to hosts that don't have a reservation. I assume that you want that functionality.

2 Likes

I was thinking about that, too. But given that the OP had the DHCP server disabled, maybe they do want to limit it to only statically assigned hosts?? Not sure.

ignore 1 definitely will shut everything down, including reservations. The DHCP process simply won't respond to any requests from any host. If you indeed want to require every host to have a reservation, then dynamicdhcp 0 would be correct. In that case start and limit are not relevant.

3 Likes

To update a little more. Currently, my DHCP is handled through a server I run Ubuntu server Graphic Line on. It is running a few things, like ad-blocker, media server, etc. Currently, I use pi-hole on that server to static assign IPs based on MAC. That being said, I am looking to transition the DCHP/IP management back to the router.

So this is why it currently shows as disabled.

Hope this helps provide clarity. I will try some of the solutions that you have provided.

But then you can set up static leases only on that server.

1 Like

Good Afternoon

That worked. The error is gone. I am going to build the static leases (a lot of them) and make the transition to "turn on" the router DHCP and the other server off. Thank You all for the help..........I am curious though...I tried the 5 before, as opposed to the 10.0.0.5 and nothing. So I not sure if the "graphical input" via the webGUI was not taking or one of the other settings was the issue?