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

  • ATTENTION! You'll notice a Prefix dropdown when you create a thread. If your post applies to one of the topics listed, please use that Prefix for your post. When browsing the thread list you can use the Prefix to filter the view.
  • ATTENTION! As of November 1, 2020, you are not able to reply to threads 6 months after the thread is opened if there are more than 500 posts in the thread.
    Threads will not be locked, so posts may still be edited by their authors.
    Just start a new thread on the topic to post if you get an error message when trying to reply to a thread.

Jack Yaz

Part of the Furniture
v1.0.2
Updated 2021-02-27

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:

dave14305

Part of the Furniture
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:

Jack Yaz

Part of the Furniture
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:

dave14305

Part of the Furniture
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.
 

elorimer

Very Senior Member
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?
 

Jack Yaz

Part of the Furniture
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
 

dave14305

Part of the Furniture
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.
 

Jack Yaz

Part of the Furniture
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
 

dave14305

Part of the Furniture
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
 

Jack Yaz

Part of the Furniture
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?!)
 

Jack Yaz

Part of the Furniture
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?
Yes you can use the GUI page

Icons should be editable in the GUI page as they were before
 

dave14305

Part of the Furniture
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