What's new

YazDHCP YazDHCP - feature expansion of DHCP assignments (increasing limit on the number of DHCP reservations)

  • 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!

Jack Yaz

Part of the Furniture
v1.0.6
Updated 2023-11-18

Feature expansion of DHCP assignments using AsusWRT-Merlin's Addons API to read and write DHCP assignments, increasing the limit on the number of reservations.

YazDHCP is free to use under the GNU General Public License version 3 (GPL 3.0).

This project is hosted on GitHub

Love the script and want to support future development? Any and all donations gratefully received!
PayPal donation
Buy me a coffee

Supported firmware versions
You must be running firmware Merlin 384.15/384.13_4 (or later) Asuswrt-Merlin

Installation
Using your preferred SSH client/terminal, copy and paste the following command, then press Enter:
Code:
/usr/sbin/curl --retry 3 "https://raw.githubusercontent.com/jackyaz/YazDHCP/master/YazDHCP.sh" -o "/jffs/scripts/YazDHCP" && chmod 0755 /jffs/scripts/YazDHCP && /jffs/scripts/YazDHCP install

Usage
WebUI

YazDHCP leverages the existing LAN - DHCP Server page in the AsusWRT-Merlin WebUI. It has been modified under the hood to read and write to files in /jffs/addons/YazDHCP.d/ via the Addons API.

This allows us to use a greater amount of storage (6KB vs 2.5-3KB) for DHCP host assignments.

Command Line
To launch the YazDHCP menu after installation, use:
Code:
YazDHCP

If this does not work, you will need to use the full path:
Code:
/jffs/scripts/YazDHCP

Changes made to dnsmasq configuration
YazDHCP adds 3 lines to dnsmasq.conf.add to configure DHCP reservations:
Code:
addn-hosts=/jffs/addons/YazDHCP.d/.hostnames # YazDHCP_hostnames
dhcp-hostsfile=/jffs/addons/YazDHCP.d/.staticlist # YazDHCP_staticlist
dhcp-optsfile=/jffs/addons/YazDHCP.d/.optionslist # YazDHCP_optionslist
addn-hosts contains a list of IP address to hostname mappings, for DNS resolution of DHCP reserved clients
dhcp-hostsfile contains a list of MAC address to IP address bindings, to reserve a DHCP IP address for a MAC address
dhcp-optsfile contains a list of MAC address to DNS server address bindings, to provide the specified DNS server as a DHCP option for a MAC address
 
Last edited:
When shall you release the shackles of the 64 entry limit? I've already got 2 entries populated and I'm getting nervous. ;)

I did end up with a conversion problem with the second entry (run after the initial install, not during the install).

1610483098135.png


nvram:
dhcp_staticlist=<B0:5C:XX:XX:XX:XX>192.168.50.4><00:9C:XX:XX:XX:XX>192.168.50.5>
It looks like dhcp_hostnames was empty in my last few backups, which seems weird to me. Could be user error before installation.
I'm such a HND-newbie. It was in the jffs file.
Code:
# cat .nvram_jffs_dhcp_hostnames
<B0:5C:XX:XX:XX:XX>HPOJ9018<00:9C:XX:XX:XX:XX>HPOJ8600
DHCP_Clients:
Code:
# cat  DHCP_clients
MAC,IP,HOSTNAME,DNS
B0:5C:XX:XX:XX:XX,192.168.50.4,HPOJ9018,
00:9C:XX:XX:XX:XX,192.168.50.5,,HPOJ8600,
 
Last edited:
When shall you release the shackles of the 64 entry limit? I've already got 2 entries populated and I'm getting nervous. ;)

I did end up with a conversion problem with the second entry (run after the initial install, not during the install).

View attachment 29446
I'll scrap the Max Limit bit since we're limited by characters and not a number of entries. (we could assume an average of X characters per entry and divide, but that won't be accurate enough for my liking)

Did you add both then save, or add the first, save, and add the second, save?

EDIT: ah you mean exporting rather than adding through the web_ui? what does your nvram for hostnames hold?
 
Last edited:
I'll scrap the Max Limit bit since we're limited by characters and not a number of entries. (we could assume an average of X characters per entry and divide, but that won't be accurate enough for my liking)

Did you add both then save, or add the first, save, and add the second, save?

EDIT: ah you mean exporting rather than adding through the web_ui? what does your nvram for hostnames hold?
Yes, I exported via the CLI menu and edited my post above.
 
This is a stupid question, I know. Is it the case that I can add and delete manual reservations from the GUI page? I thought I might need to be editing the YazDHCP.d files.

Also, do the icons also get edited here, or is that from the Network Map page?
 
Are you inadvertently throwing away the optional DNS server in dhcp_staticlist when you sed >< with \n in line 536?
I shouldn't be, I did test that with one host with a DNS server added. I'll fire up my new 68U in a bit which will run nvram and give it a double check
 
I shouldn't be, I did test that with one host with a DNS server added. I'll fire up my new 68U in a bit which will run nvram and give it a double check
I've got a test case now on my 86U where both entries had DNS entries and it turned out messy.
Code:
# cat DHCP_clients
MAC,IP,HOSTNAME,DNS
B0:5C:XX:XX:XX:XX,192.168.50.4,9.9.9.900:9C:XX:XX:XX:XX,192.168.50.5,1.1.1.3,HPOJ9018,
Let me make sure I didn't restore the old nvram wrong though.
 
I've got a test case now on my 86U where both entries had DNS entries and it turned out messy.
Code:
# cat DHCP_clients
MAC,IP,HOSTNAME,DNS
B0:5C:XX:XX:XX:XX,192.168.50.4,9.9.9.900:9C:XX:XX:XX:XX,192.168.50.5,1.1.1.3,HPOJ9018,
Let me make sure I didn't restore the old nvram wrong though.
I've repro'd working on a fix now
 
I've repro'd working on a fix now
Great. I was just going to post some evidence.
Code:
# sed 's/></\n/g;s/>/ /g;s/<//g' /jffs/nvram/dhcp_staticlist
00:9C:XX:XX:XX:XX 192.168.50.5 9.9.9.9B0:5C:XX:XX:XX:XX 192.168.50.4 9.9.9.9
# sed 's/</\n/g;s/>/ /g;s/<//g' /jffs/nvram/dhcp_staticlist

00:9C:XX:XX:XX:XX 192.168.50.5 9.9.9.9
B0:5C:XX:XX:XX:XX 192.168.50.4 9.9.9.9
 
Great. I was just going to post some evidence.
Code:
# sed 's/></\n/g;s/>/ /g;s/<//g' /jffs/nvram/dhcp_staticlist
00:9C:XX:XX:XX:XX 192.168.50.5 9.9.9.9B0:5C:XX:XX:XX:XX 192.168.50.4 9.9.9.9
# sed 's/</\n/g;s/>/ /g;s/<//g' /jffs/nvram/dhcp_staticlist

00:9C:XX:XX:XX:XX 192.168.50.5 9.9.9.9
B0:5C:XX:XX:XX:XX 192.168.50.4 9.9.9.9
I fixed one problem and found another. If a host has a DNS server specified and no hostname there's a parsing error. Working on that now.

(where were you during the alpha?!)
 
Been a while since I had anything alcoholic! And yeah.....

Anyway, should now be fixed!
Awesome. Will give it a run after dinner. Do you think the same problem exists on line 120? echo "$DHCPCLIENTS" | sed 's/|/:/g;s/></\n/g;s/>/ /g;s/<//g' > /tmp/yazdhcp_clients_parsed.tmp
 

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

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