What's new

YazDHCP - alpha - Extended DHCP management script

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

I have set up (more than) a few networks, including mine, just like @elorimer suggests. That is, I have a DHCP Pool of .169 to .232 (router sits at .254) and manually assign my own devices between .3 to .167 and, between .233 to 253 too.

Seems to work (and for a few years now too).

Now, I'm questioning if I need to rethink this? Would love to see more discussion and an authoritative answer on why this is a good or bad idea to continue this practice.
 
dnsmasq man page only stipulates that the reservations only have to be from a subnet containing a valid range.
Addresses allocated like this are not constrained to be in the range given by the --dhcp-range option, but they must be in the same subnet as some valid dhcp-range.
 
dnsmasq man page
Very helpful and I should have looked there first.

Also, this: "Addresses will be given out from the range <start-addr> to <end-addr> and from statically defined addresses given in --dhcp-host options."

"statically defined" adding to the muddle, but clear that manual assignment doesn't need to be in the range.
 
I have set up (more than) a few networks, including mine, just like @elorimer suggests. That is, I have a DHCP Pool of .169 to .232 (router sits at .254) and manually assign my own devices between .3 to .167 and, between .233 to 253 too.

Seems to work (and for a few years now too).

Now, I'm questioning if I need to rethink this? Would love to see more discussion and an authoritative answer on why this is a good or bad idea to continue this practice.

You don't have an IPv6 connection? :eek: (it's 2021 and i know there are ISPs that still haven't...figured it out) o_O
 
while you can assign an IP outside the pool, strictly speaking, you shouldn't. at least, that's my understanding. you're effectively reserving a DHCP address for a client
There are some situations where you may want to try especially if the device is dedicated to that IP address. I have seen some cases where other devices try to favor a certain IP that I assigned to a device that was on the edge of the IP pool. For example my IP pool starts at 192.168.1.20 because I have a device assigned an IP address 192.168.1.16. There is a paticular device on my network that I cannot configure manually that always wants that IP address. I had to start my IP pool past .16 so the device would pick a different address. In this particular situation, I only reserve the first 19 addresses. The other devices I do not care about.
 
You could always migrate your config into YazDHCP and then you get GUI editing back? Assuming you're not using over 6500 characters in what is/was the nvram format:
Code:
<MAC>IP>HOSTNAME>DNS>
Per host. If no DNS specified (i.e. "Default"), each host becomes
Code:
<MAC>IP>HOSTNAME>
Sorry, been meaning to catch up to this.

So, my dnsmasq.conf.add has lines like this:

dhcp-host=A8:5E:45:E9:E0:58,192.168.1.7,AX58Mesh1

So to migrate, I change that to:

<A8:5E:45:E9:E0:58>192.168.1.7>AX58Mesh1>

And put that into a file /jffs/addons/YazDHCP.d/.staticlist?

After I have added your addon of course! And remove the /jffs/configs/dnsmasq.conf.add file as well (or rename it more likely).


Should I keep my hosts.add as is?

Thanks Jack
 
Sorry, been meaning to catch up to this.

So, my dnsmasq.conf.add has lines like this:

dhcp-host=A8:5E:45:E9:E0:58,192.168.1.7,AX58Mesh1

So to migrate, I change that to:

<A8:5E:45:E9:E0:58>192.168.1.7>AX58Mesh1>

And put that into a file /jffs/addons/YazDHCP.d/.staticlist?

After I have added your addon of course! And remove the /jffs/configs/dnsmasq.conf.add file as well (or rename it more likely).


Should I keep my hosts.add as is?

Thanks Jack
Sorry, I was confirming how you'd format the string to check the length. To migrate, you should create a file as below:
Code:
admin@RT-AC86U:/jffs/addons/YazDHCP.d# cat DHCP_clients
MAC,IP,HOSTNAME,DNS
AF:9E:15:F8:39:C3,10.14.16.10,PC1, 
38:D9:41:AD:09:3E,10.14.16.11,PC2,8.8.8.8
When you then use the "process" option in YazDHCP it will create the relevant (hidden) files in the same directory which are referenced in dnsmasq.conf.add

Any manual dhcp-host lines and DHCP entries in hosts.add can be removed
 
Sorry, I was confirming how you'd format the string to check the length. To migrate, you should create a file as below:
Code:
admin@RT-AC86U:/jffs/addons/YazDHCP.d# cat DHCP_clients
MAC,IP,HOSTNAME,DNS
AF:9E:15:F8:39:C3,10.14.16.10,PC1,
38:D9:41:AD:09:3E,10.14.16.11,PC2,8.8.8.8
When you then use the "process" option in YazDHCP it will create the relevant (hidden) files in the same directory which are referenced in dnsmasq.conf.add

Any manual dhcp-host lines and DHCP entries in hosts.add can be removed
So, if there is no DNS option, still print a "," at the end of the line?
 
I think I've read enough to want to jump into the deep end now @Jack Yaz .....How's the water so far? :)

PM to send over the command please.
 
I think I've read enough to want to jump into the deep end now @Jack Yaz .....How's the water so far? :)

PM to send over the command please.
You'll likely want to be following this over at github. The readme has the instruction.

Backup your config + jffs before, so you can revert. I jumped in a few days ago and the water was too cold for me. Specifically it looked like all the existing reservations disappeared. So I'm reading the script to understand better.
 
You'll likely want to be following this over at github. The readme has the instruction.

Backup your config + jffs before, so you can revert. I jumped in a few days ago and the water was too cold for me. Specifically it looked like all the existing reservations disappeared. So I'm reading the script to understand better.
Did you opt to export nvram? If so, I'd be interested to know what resulted in DHCP_Clients file
 
Did you opt to export nvram?
I pasted the one line in the readme into a terminal window (ends in the install command), and after a second or so got the prompt back. I went to the web page and saw that there was the new header, but the rest of the DHCP page seemed to be the same except no more reserved IPs. There was no export option, etc. presented. So I reverted and uninstalled.

As a first order approximation, it looked to me like an ID10T error on my end rather than a bug in the script so I haven't reported it.

EDIT: OK, so I did it again:
Code:
YazDHCP: Welcome to YazDHCP v0.0.1, a script by JackYaz

YazDHCP: Checking your router meets the requirements for YazDHCP

YazDHCP: New version of Advanced_DHCP_Content.asp downloaded

YazDHCP: YazDHCP installed successfully!

elorimer@RT-AC86U:/tmp/home/root#
No DHCP_Clients file.
No hidden staticlist or optionslist either.
 
Last edited:
I pasted the one line in the readme into a terminal window (ends in the install command), and after a second or so got the prompt back. I went to the web page and saw that there was the new header, but the rest of the DHCP page seemed to be the same except no more reserved IPs. There was no export option, etc. presented. So I reverted and uninstalled.

As a first order approximation, it looked to me like an ID10T error on my end rather than a bug in the script so I haven't reported it.

EDIT: OK, so I did it again:
Code:
YazDHCP: Welcome to YazDHCP v0.0.1, a script by JackYaz

YazDHCP: Checking your router meets the requirements for YazDHCP

YazDHCP: New version of Advanced_DHCP_Content.asp downloaded

YazDHCP: YazDHCP installed successfully!

elorimer@RT-AC86U:/tmp/home/root#
No DHCP_Clients file.
No hidden staticlist or optionslist either.
Hm, maybe I didn't commit the prompt to export nvram. One minute....
EDIT: fixed now - the assignments should still exist in nvram since I only touch nvram on export, the Web UI is looking for the new file which wasn't populated, hence them being missing. If you want to skip re-installing, option x at the cli does the same thing
 
On two counts: yes, now I've gotten the prompt to export but the script didn't find anything in DHCP_clients to process; yes, simply uninstalling brought back the nvram list onto the page.
 
On two counts: yes, now I've gotten the prompt to export but the script didn't find anything in DHCP_clients to process; yes, simply uninstalling brought back the nvram list onto the page.
Hm, the export (option x) should populate DHCP_Clients and will backup and delete the nvram settings - if the nvram settings were intact it sounds like the export didnt complete.
 
This might help. I had restored my .cfg files (to get back the nvram list) but hadn't restored my jffs backup, so I had no host names in my pool. When I installed the script, I got this:
Code:
YazDHCP: Welcome to YazDHCP v0.0.1, a script by JackYaz

YazDHCP: Checking your router meets the requirements for YazDHCP


Do you want to export DHCP assignments and hostnames from nvram to YazDHCP DHCP client files? (y/n)
YazDHCP will backup nvram/jffs DHCP data as part of the export, but you may wish to screenshot http://192.168.50.1:8443/Advanced_DHCP_Content.asp

Enter answer (y/n):    y
YazDHCP: DHCP hostnames not exported from nvram, no data found

YazDHCP: YazDHCP installed successfully!
When I restored both the .cfg and jffs so as to have the host names, when I installed the script I got this:
Code:
YazDHCP: Welcome to YazDHCP v0.0.1, a script by JackYaz
YazDHCP: Checking your router meets the requirements for YazDHCP
YazDHCP: New version of Advanced_DHCP_Content.asp downloaded
Do you want to export DHCP assignments and hostnames from nvram to YazDHCP DHCP client files? (y/n)
YazDHCP will backup nvram/jffs DHCP data as part of the export, but you may wish to screenshot http://192.168.50.1:8443/Advanced_DHCP_Content.asp
Enter answer (y/n):    y
YazDHCP: DHCP information successfully exported from nvram
YazDHCP: DHCP hostname list updated successfully
YazDHCP: DHCP static assignment list updated successfully
YazDHCP: DHCP options list updated successfully
cd YazDHCP: YazDHCP installed successfully!
And this time I have the three files in the .d directory.
 

Similar threads

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top