DHCP Server ignoring static lease

Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware
Goto page 1, 2  Next
Author Message
slartibartfast
DD-WRT Novice


Joined: 31 May 2014
Posts: 5

PostPosted: Tue Jul 25, 2023 18:09    Post subject: DHCP Server ignoring static lease Reply with quote
Builds tried: r39267, r52894, r53323
Router brand: Asus
Router model: RT-AC66U A1
Operating mode: AP
Connection type: WiFi
Subnet: 192.168.20.0/24
DHCP pool: 192.168.20.100 - 192.168.20.199

Back in 2019 I decommissioned an Asus router running Merlin firmware. I'd installed DD-WRT on several earlier devices on various SoCs and decided to do the same with this one (r39267), but then I never wound up putting it into service after all. Now I'm waiting on a Starlink hardware kit and plan to put it in bypass mode and use my own router so I pulled the RT-AC66U out with the intention to update to a current release and use that with Starlink. After some research here I decided to go with r52894 rather than the latest r53323.

I did the upgrade without a reset and everything seemed to come back up perfectly, but then I tested setting a static lease since I will need two of them at the cottage. DD-WRT accepts the configuration, but when the device with that MAC address connects it is assigned an IP from the dynamic pool, not the static IP I specified for it. When I look at the LAN status page the device shows there, with the MAC address I used for the static lease configuration, but the IP address is wrong. The static address I'm trying to assign is within the correct subnet but well outside the DHCP dynamic pool.

I then disconnected from the WiFi AP and connected with Ethernet. I went to the LAN status page and deleted the "DHCP Clients" entry for the WiFi connection with the relevant MAC and rebooted the router to make sure it wasn't just reinstating the old lease, but even after the reboot connecting the laptop with that MAC address still always gets a dynamic IP from the pool instead of being assigned the desired static address.

Next I reverted to r39267 but with a NVRAM clear this time and set it all back up, but again when I configure that static lease it just gets ignored. I have since switched between r39267, r52894, and r53323 several times with a full reset each time, but still no go.

With each of the three releases I have tried this with "Use JFFS2 for client lease DB" enabled, or "Use NVRAM for client lease DB" enabled, or neither. No change however I set those two switches. I also tried configuring the lease with a 1440 minute lease time instead of infinite, but again no change.

This is such an important router feature that I can't believe it has been broken in DD-WRT since at least 2019 and instead I must be doing something wrong, but I can't figure out what it is.



Cropped.png
 Description:
DHCP Server config
 Filesize:  18.35 KB
 Viewed:  3118 Time(s)

Cropped.png


Sponsor
dale_gribble39
DD-WRT Guru


Joined: 11 Jun 2022
Posts: 1959

PostPosted: Tue Jul 25, 2023 19:23    Post subject: Reply with quote
Because it's outside the DHCP pool. Static leases are not static IP addresses. Static IP addresses are configured on the client side.

https://www.lifewire.com/what-is-a-static-ip-address-2626012

https://www.howtogeek.com/69612/how-to-set-up-static-dhcp-on-your-dd-wrt-router/
slartibartfast
DD-WRT Novice


Joined: 31 May 2014
Posts: 5

PostPosted: Tue Jul 25, 2023 20:34    Post subject: Reply with quote
dale_gribble39 wrote:
Because it's outside the DHCP pool. Static leases are not static IP addresses. Static IP addresses are configured on the client side.

https://www.lifewire.com/what-is-a-static-ip-address-2626012

https://www.howtogeek.com/69612/how-to-set-up-static-dhcp-on-your-dd-wrt-router/


Yes, I know what a static lease is, I've been using them for decades. DD-WRT strongly recommends defining static leases outside the DHCP pool. From that page, in bold...

"Note: It is recommended but not necessary to set your static leases outside of your automatic DHCP address range."
dale_gribble39
DD-WRT Guru


Joined: 11 Jun 2022
Posts: 1959

PostPosted: Tue Jul 25, 2023 21:09    Post subject: Reply with quote
And it used to read "Warning: Be sure to set your static IPs outside of your automatic DHCP address range."

Someone who does not understand basic networking or DHCP whatsoever completely fubar'd that whole point. No DHCP server will hand out IP addresses outside of the configured range of IP addresses. And apparently you do not understand this.

_________________
"The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep." - Robert Frost

"I am one of the noticeable ones - notice me" - Dale Frances McKenzie Bozzio

<fact>code knows no gender</fact>

This is me, knowing I've ruffled your feathers, and not giving a ****
Some people are still hard-headed.

--------------------------------------
Mac Pro (Mid 2012) - Two 2.4GHz 6-Core Intel Xeon E5645 processors 64GB 1333MHz DDR3 ECC SDRAM OpenSUSE Leap 15.5
kernel-panic69
DD-WRT Guru


Joined: 08 May 2018
Posts: 14249
Location: Texas, USA

PostPosted: Tue Jul 25, 2023 22:09    Post subject: Reply with quote
Most any DHCP server hands out IP addresses within whatever the value of "dhcp-range" is, whether a reserved (static) lease's IP address or not, with some exception. Neither udhcpd nor dnsmasq has ever functioned in DD-WRT like ISC dhcpd can that I am aware of. For example, from a sample dhcpd.conf file for ISC dhcpd:

Code:
# Define a host named thecrue, and statically
# assign an IP address to it
host thecrue {
        hardware ethernet 00:24:8c:4e:07:f6;
        fixed-address 192.168.1.2;


Thanks for pointing out a (possible) long-standing gross misunderstanding error in the wiki. It's been fixed. Quite honestly, "Static Leases" in the webUI should be changed to "DHCP Reservations" to avoid confusion. Also, I do not recall if using a '-' in a static lease hostname cause dnsmasq to not start or not as the udhcpd applet from busybox is no longer being used, whatsoever. Maybe @mrjcd will chime in and offer some insight. If this is an actual bug as determined by others, then we'll work on resolving the issue, but I have never known DD-WRT to use IP addresses outside the DHCP pool for static leases.

_________________
"Life is but a fleeting moment, a vapor that vanishes quickly; All is vanity"
Contribute To DD-WRT
Pogo - A minimal level of ability is expected and needed...
DD-WRT Releases 2023 (PolitePol)
DD-WRT Releases 2023 (RSS Everything)

----------------------
Linux User #377467 counter.li.org / linuxcounter.net
mrjcd
DD-WRT Guru


Joined: 31 Jan 2015
Posts: 6292
Location: Texas

PostPosted: Wed Jul 26, 2023 4:36    Post subject: Reply with quote
kernel-panic69 wrote:
Maybe @mrjcd will chime in

main gateway unit


its handout DHCP range


br1 DHCP


-------

10.72.28.1 ~ 10.72.28.254 ...minus the 10.72.28.13 router's IP
DHCP start IP is 10.72.28.64
Max I have set is 100
AND I also have a br1 guest net which uses much small DHCP pool.
I do have some devices set as static DHCP for br1 also...
...they are outside of its DHCP handout but NOT outside if its DHCP range.
br1 static DHCP is towards bottom of list
yeahuh just for hellofit I have always used infinite ( 0 time ) for static DHCP stuffs
Code:
mrjcd@daDeb:~$ ssh root@citadel-station-homeworld.mrjcd.com
DD-WRT v3.0-r53323 std (c) 2023 NewMedia-NET GmbH
Release: 07/15/23
Board: Linksys EA8500
==========================================================
 
     ___  ___     _      _____  ______       ____  ___
    / _ \/ _ \___| | /| / / _ \/_  __/ _  __|_  / / _ \
   / // / // /___/ |/ |/ / , _/ / /   | |/ //_ <_/ // /
  /____/____/    |__/|__/_/|_| /_/    |___/____(_)___/
                                                     
                       DD-WRT v3.0
                   https://www.dd-wrt.com


==========================================================


BusyBox v1.36.1 (2023-07-15 12:14:48 +07) built-in shell (ash)

root@Citadel-Station-Homeworld:~# grep dhcp-host /tmp/dnsmasq.conf
dhcp-host=00:1C:C0:41:BF:E7,Apache,10.72.28.1,infinite
dhcp-host=00:14:51:03:E5:EE,da-Box,10.72.28.2,infinite
dhcp-host=90:B1:1C:9C:F3:EF,daDeb,10.72.28.3,infinite
dhcp-host=20:CF:30:9B:5A:89,Deb,10.72.28.4,infinite
dhcp-host=00:0A:95:B5:1C:38,1505,10.72.28.5,infinite
dhcp-host=00:14:51:16:d2:78,DogCow,10.72.28.6,infinite
dhcp-host=1C:87:2C:7D:E9:08,GrammyRTN12D1,10.72.28.7,infinite
dhcp-host=D4:BE:D9:C4:0D:C3,390-Deb,10.72.28.8,infinite
dhcp-host=00:0A:95:D5:61:80,Barb,10.72.28.9,infinite
dhcp-host=C4:41:1E:32:14:4A,OMG-Deb,10.72.28.10,infinite
dhcp-host=E4:A4:71:C8:8A:9D,DebLynn,10.72.28.11,infinite
dhcp-host=B4:4B:D6:2C:2F:39,Deb-Rayne,10.72.28.12,infinite
dhcp-host=58:00:E3:90:A8:19,Fat-Deb,10.72.28.16,infinite
dhcp-host=00:13:10:EC:77:24,VOLUS_Earth-Orbit47-HQ,10.72.28.47,infinite
dhcp-host=00:40:10:20:00:01,VOLUS_Outpost-AP48,10.72.28.48,infinite
dhcp-host=C8:D7:19:75:AE:B2,Volus-E2500,10.72.28.50,infinite
dhcp-host=A4:2B:8C:0E:88:47,Citadel-Switch,10.72.28.51,infinite
dhcp-host=C0:56:27:08:B2:92,EA8500,10.72.28.52,infinite
dhcp-host=00:16:B6:50:2A:46,Volus-Link53,10.72.28.53,infinite
dhcp-host=68:7F:74:15:70:25,160NL-Switch,10.72.28.54,infinite
dhcp-host=C8:B3:73:27:47:68,Volus-E1200v2,10.72.28.55,infinite
dhcp-host=B8:86:87:D6:4A:69,Will-Be-Was,10.72.28.56,infinite
dhcp-host=68:7F:74:AC:35:4E,E2100L-WDS-South,10.72.28.57,infinite
dhcp-host=68:7F:74:D7:BA:40,E2100L-WDS-North,10.72.28.58,infinite
dhcp-host=00:12:3F:7B:7B:C0,DXP051-Deb,10.72.28.59,infinite
dhcp-host=10:0D:7F:61:A8:A9,WNR2000v3,10.72.28.60,infinite
dhcp-host=08:9E:08:48:4A:7F,Kitchen-Chromecast,10.15.26.228,infinite
dhcp-host=D0:AE:EC:F5:28:27,BR-BRDPlayer,10.15.26.229,infinite
dhcp-host=F0:EF:86:A8:89:08,BR-Chromecast,10.15.26.230,infinite
dhcp-host=E4:AA:EA:2E:1F:47,LR-BRDPlayer,10.15.26.231,infinite
dhcp-host=C8:D7:19:16:CD:31,ASUS-1740,10.15.26.232,infinite
dhcp-host=CC:95:D7:53:CF:8B,VIZIO-TV,10.15.26.226,infinite
dhcp-host=A4:77:33:80:1A:EC,LR-Chromecast,10.15.26.227,infinite
root@Citadel-Station-Homeworld:~# uptime && date
 23:19:50 up 9 days, 15:16,  load average: 0.00, 0.00, 0.00
Tue Jul 25 23:19:50 CDT 2023
root@Citadel-Station-Homeworld:~#
Connection to citadel-station-homeworld.mrjcd.com closed.
mrjcd@daDeb:~$
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12922
Location: Netherlands

PostPosted: Wed Jul 26, 2023 7:39    Post subject: Reply with quote
I am a bit lost in this thread but as many users use static leases it is not likely it is broken.

One word of warning do not use "Use JFFS2 for client lease DB", or "Use NVRAM for client lease DB" they are known to cause problems.

As usual you set static leases outside the DHCP pool but inside the DHCP range.

Many users do not use the GUI but simply add the static leases in the Additional Options e.g.:
Code:
dhcp-host=40:B0:76:XX:XX:XX,192.168.0.59,My-PC,1440m
dhcp-host=00:08:9B:XX:XX:XX,192.168.0.91,QNAP453,1440m


As it is easier to administer and copy/paste from a text file.

You can check with `cat /tmp/dnsmasq.conf` that the leases from the the GUI are also there in the same format and grab them from there to store offline.

Only limited characters are allowed for the hostname but hyphens and underscore should be allowed.

The picture you showed is from an ancient build, make sure that after an upgrade you not only reset to defaults and put settings in manually, if you come from an old build, but also clear your browser cache.

Note that modern appliances (phones, laptop) usually use random MAC addresses, so those will not adhere to static leases unless that is switched off.
Mostly you can turn off the random MAC address on a per wifi base so that you can switch it off only for your home wifi but still use it on the road.

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
redhawk0
DD-WRT Guru


Joined: 04 Jan 2007
Posts: 11564
Location: Wherever the wind blows- North America

PostPosted: Thu Jul 27, 2023 13:21    Post subject: Reply with quote
Static leases are working fine...and a "-" isn't the problem. It could be the "Use NVRAM for client lease DB" as egc said.

The only other possibility is that it's a bug for the build you are using for that model router...but without that model...I couldn't tell you.

I'm currently on my fallback build of 53045.

[EDIT] - BTW...my DHCP is set up for 192.168.1.201-250 dishing out 50 addresses. So you see my static leases are all in the 192.168.1.2 - 100 range.

redhawk



static.jpg
 Description:
 Filesize:  384.67 KB
 Viewed:  2850 Time(s)

static.jpg


kernel-panic69
DD-WRT Guru


Joined: 08 May 2018
Posts: 14249
Location: Texas, USA

PostPosted: Thu Jul 27, 2023 22:39    Post subject: Reply with quote
Wiki edit duly reverted and text formatting added in one fell swoop. I presume blank least time field is intentional masking or equals "infinite" for lease time. One thing I have noticed between working examples and the OP is that the OP's lease is all caps. Try changing that up or using the Winblows / Linux hostname (or set that to be what you want it to be in the lease)?
_________________
"Life is but a fleeting moment, a vapor that vanishes quickly; All is vanity"
Contribute To DD-WRT
Pogo - A minimal level of ability is expected and needed...
DD-WRT Releases 2023 (PolitePol)
DD-WRT Releases 2023 (RSS Everything)

----------------------
Linux User #377467 counter.li.org / linuxcounter.net
redhawk0
DD-WRT Guru


Joined: 04 Jan 2007
Posts: 11564
Location: Wherever the wind blows- North America

PostPosted: Fri Jul 28, 2023 15:15    Post subject: Reply with quote
kernel-panic69 wrote:
I presume blank least time field is intentional masking or equals "infinite" for lease time.


Yes...blank is infinite. I have in the past set a few infrequent connections to 720 so the leases expire and don't show a connection in my list after 12 hours.

Code:
exa....In cmdline format:

nvram set static_leasenum=2
nvram set static_leases="40:F3:XX:XX:XX:XX=cj-tab10=192.168.1.34= 5A:0F:XX:XX:XX:XX=bc-phone=192.168.1.80=720"
nvram commit


The space after the 34= indicates it's an infinite lease....if it was the last lease in the line (below) then it would be ".....1.80= " The space here after 80= would still be needed for proper formatting of the variable.

Code:
nvram set static_leasenum=2
nvram set static_leases="40:F3:XX:XX:XX:XX=cj-tab10=192.168.1.34=720 5A:0F:XX:XX:XX:XX=bc-phone=192.168.1.80= "
nvram commit



redhawk
ghent96
DD-WRT Novice


Joined: 28 Aug 2023
Posts: 15

PostPosted: Fri Sep 01, 2023 15:54    Post subject: Reply with quote
Sorry, I'm confused... ddwrt is substantially different from my previous several router web interfaces, and I don't understand how you can assign static IPs outside of the DHCP range. Also, not really sure how to set the DHCP range in ddwrt. Previous router interfaces have all had an IP for the router, and then a specific range that I can set, eg - 192.168.0.1 - 192.168.0.52 , and then I would just click on clients currently connected in a chart/list, and lock them into an IP by MAC address.

...I see that ddwrt appears to have a start IP, and a # of clients, but how can you assign static IPs outside of that?
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12922
Location: Netherlands

PostPosted: Fri Sep 01, 2023 16:11    Post subject: Reply with quote
ghent96 wrote:
Sorry, I'm confused... ddwrt is substantially different from my previous several router web interfaces, and I don't understand how you can assign static IPs outside of the DHCP range. Also, not really sure how to set the DHCP range in ddwrt. Previous router interfaces have all had an IP for the router, and then a specific range that I can set, eg - 192.168.0.1 - 192.168.0.52 , and then I would just click on clients currently connected in a chart/list, and lock them into an IP by MAC address.

...I see that ddwrt appears to have a start IP, and a # of clients, but how can you assign static IPs outside of that?


The advice is to set static leases outside the DHCP range

My DHCP start address is 64 for 64 addresses.

Use static leases below 64 or above 128 Smile

On the Status Page LAN, click on the + behind the connected client to set a static lease

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
Per Yngve Berg
DD-WRT Guru


Joined: 13 Aug 2013
Posts: 6872
Location: Romerike, Norway

PostPosted: Sat Sep 02, 2023 18:38    Post subject: Reply with quote
Have the dhcp pool start at 100 is a bad idea. 100 is not a round binary number and cannot be addresses by a nettmaskene. 128 is 10000000 and is a boundry. Makes it easier later when you start with pbr.
ghent96
DD-WRT Novice


Joined: 28 Aug 2023
Posts: 15

PostPosted: Tue Sep 05, 2023 4:06    Post subject: Reply with quote
what's "pbr" ?

So, I guess I was thinking since the DHCP service assigns all the IPs, that there was no possible way to assign a static IP outside of the "range". I guess I'm wrong? So I need to set all my static IPs, for example, from 2 - 29, then start the DHCP range at 30 for 10 clients ...or however many other clients, like visiting family devices. I don't want to allow many, for my home network, maybe only 10.

also, there is no "+" sign after each DHCP client in the Status > Lan page. There is only a "delete lease" trash can icon. ddwrt version: Firmware: DD-WRT v3.0-r46446 mini (04/24/21)
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12922
Location: Netherlands

PostPosted: Tue Sep 05, 2023 6:20    Post subject: Reply with quote
ghent96 wrote:
what's "pbr" ?


For unrelated questions start a new thread


ghent96 wrote:
So, I guess I was thinking since the DHCP service assigns all the IPs, that there was no possible way to assign a static IP outside of the "range". I guess I'm wrong? So I need to set all my static IPs, for example, from 2 - 29, then start the DHCP range at 30 for 10 clients ...or however many other clients, like visiting family devices. I don't want to allow many, for my home network, maybe only 10.


Correct

ghent96 wrote:
also, there is no "+" sign after each DHCP client in the Status > Lan page. There is only a "delete lease" trash can icon. ddwrt version: Firmware: DD-WRT v3.0-r46446 mini (04/24/21)


That is because you are running an old and outdated build.
See the forum guidelines with helpful pointers about how to research your router, where and what firmware to download, where and how to post and many other helpful tips:
https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
Goto page 1, 2  Next Display posts from previous:    Page 1 of 2
Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum