DhcpStaticList

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

EventPhotoMan

Very Senior Member
I’m not entirely sure my script is running

dhcpstaticlist.sh

how can I check?

be easy on me, I’m not that familiar with Lunix
Running 384.19

I have endeared running with spdmerlin and ntpmerlin.

should there be a start up in services-start file of /JFFS/scripts?
 

LimJK

Senior Member
I’m not entirely sure my script is running

dhcpstaticlist.sh

how can I check?

be easy on me, I’m not that familiar with Lunix
Running 384.19

I have endeared running with spdmerlin and ntpmerlin.

should there be a start up in services-start file of /JFFS/scripts?
EventPhotoMan,
See if this is relevant :)

 

EventPhotoMan

Very Senior Member
We have no idea what this script does or how it's meant to be invoked, so it's impossible for us to answer your question.
Sorry,
It’s DhcpStaticList.sh by @Xentrk dates January 4, 2019

I was using it, and it would import my /JFFS /configs/dnsmasq.conf.add into my static list.

if figured out how to run the script utility.

Is there instructions some where?
 

Xentrk

Part of the Furniture
I’m not entirely sure my script is running

dhcpstaticlist.sh

how can I check?

be easy on me, I’m not that familiar with Lunix
Running 384.19

I have endeared running with spdmerlin and ntpmerlin.

should there be a start up in services-start file of /JFFS/scripts?
What is your intent?

The script is installed in /jffs/scripts. copy/past the installation code below into a SSH command line.

Code:
/usr/sbin/curl --retry 3 "https://raw.githubusercontent.com/Xentrk/Asuswrt-Merlin-Linux-Shell-Scripts/master/dhcpstaticlist.sh" -o "/jffs/scripts/dhcpstaticlist.sh" && chmod 755 /jffs/scripts/dhcpstaticlist.sh && sh /jffs/scripts/dhcpstaticlist.sh
You should use the updated NVRAM Save/Restore utility for saving the staticlist and hostname nvram parms going forward as it has more features. But this utility can help those who are short on nvram space by migrating dhcp lease reservations to /jffs/configs/dnsmasq.conf.add file. You can preview how it would appear in option 3 and implement using option 4.

Code:
Use this utility to save or restore dhcp_staticlist and dhcp_hostnames nvram values

[1] - Save nvram dhcp_staticlist and dhcp_hostnames to /opt/tmp/
[2] - Restore nvram dhcp_staticlist and dhcp_hostnames from /opt/tmp/
[3] - Preview dhcp_staticlist and dhcp_hostnames in dnsmasq format
[4] - Append dhcp_staticlist and dhcp_hostnames to dnsmasq.conf.add & Disable DHCP Manual Assignment
[5] - Disable DHCP Manual Assignment
[6] - Enable DHCP Manual Assignment
[7] - Backup nvram dhcp_staticlist and dhcp_hostnames to /opt/tmp/ and clear nvram values
[8] - Display character size of dhcp_staticlist and dhcp_hostnames (2999 is the limit)
[e] - Exit

==>
To execute a script, type "sh filename.sh" e.g. sh /jffs/scripts/dhcpstaticlist.sh. If you are in the directory, you can skip the directory path reference.
 

EventPhotoMan

Very Senior Member
What is your intent?

The script is installed in /jffs/scripts. copy/past the installation code below into a SSH command line.

Code:
/usr/sbin/curl --retry 3 "https://raw.githubusercontent.com/Xentrk/Asuswrt-Merlin-Linux-Shell-Scripts/master/dhcpstaticlist.sh" -o "/jffs/scripts/dhcpstaticlist.sh" && chmod 755 /jffs/scripts/dhcpstaticlist.sh && sh /jffs/scripts/dhcpstaticlist.sh
To execute a script, type "sh filename.sh" e.g. sh /jffs/scripts/dhcpstaticlist.sh. If you are in the directory, you can skip the directory path reference.
I just want to add static IP address is two more than 128 devices
 

EventPhotoMan

Very Senior Member
What is your intent?

The script is installed in /jffs/scripts. copy/past the installation code below into a SSH command line.

Code:
/usr/sbin/curl --retry 3 "https://raw.githubusercontent.com/Xentrk/Asuswrt-Merlin-Linux-Shell-Scripts/master/dhcpstaticlist.sh" -o "/jffs/scripts/dhcpstaticlist.sh" && chmod 755 /jffs/scripts/dhcpstaticlist.sh && sh /jffs/scripts/dhcpstaticlist.sh
You should use the updated NVRAM Save/Restore utility for saving the staticlist and hostname nvram parms going forward as it has more features. But this utility can help those who are short on nvram space by migrating dhcp lease reservations to /jffs/configs/dnsmasq.conf.add file. You can preview how it would appear in option 3 and implement using option 4.

Code:
Use this utility to save or restore dhcp_staticlist and dhcp_hostnames nvram values

[1] - Save nvram dhcp_staticlist and dhcp_hostnames to /opt/tmp/
[2] - Restore nvram dhcp_staticlist and dhcp_hostnames from /opt/tmp/
[3] - Preview dhcp_staticlist and dhcp_hostnames in dnsmasq format
[4] - Append dhcp_staticlist and dhcp_hostnames to dnsmasq.conf.add & Disable DHCP Manual Assignment
[5] - Disable DHCP Manual Assignment
[6] - Enable DHCP Manual Assignment
[7] - Backup nvram dhcp_staticlist and dhcp_hostnames to /opt/tmp/ and clear nvram values
[8] - Display character size of dhcp_staticlist and dhcp_hostnames (2999 is the limit)
[e] - Exit

==>
To execute a script, type "sh filename.sh" e.g. sh /jffs/scripts/dhcpstaticlist.sh. If you are in the directory, you can skip the directory path reference.
@Xentrk , so I have my old dnsmasq.conf.add file in /jffs/configs/ how do I import this file in?
 

EventPhotoMan

Very Senior Member
@Xentrk , so I have my old dnsmasq.conf.add file in /jffs/configs/ how do I import this file in?
So, this I what I tried using 384.19 firmware.

I enabled manual assignment.

then added a client name, my iPhone, and manually assigned it an IP address 192.168.1.191 (outside of the DHCP server of 138-190)
Clicked on apply, and the GUI refreshed with no new static IP address listed.

my intent was to use the script and see if it would have the manual list to the /opt/tmp/
 

EventPhotoMan

Very Senior Member
I re-installed the script. Seems to work fine.

option 1, works and it saves files to /opt/tmp ; but, both files are empty.

option 8 results in 0 characters.

and I still cannot enable manual assignment and add a static IP address to a MAC (client name)

any suggestions?
 

EventPhotoMan

Very Senior Member
I re-installed the script. Seems to work fine.

option 1, works and it saves files to /opt/tmp ; but, both files are empty.

option 8 results in 0 characters.

and I still cannot enable manual assignment and add a static IP address to a MAC (client name)

any suggestions?
Opened NetworkMaps>Clients and edited a device (listed on the right side) and manually bound an IP address to a MAC address.

then I went back to WAN>DhcpServer and I found my device listed as a static IP, hurray!

I can now manually add entries to the list.

seems like something in the router got reset.

so I’m going to try to export now.

Using option 8 on the script now yeilds an answer of 64 characters used. Good news.
 

EventPhotoMan

Very Senior Member
Used option 4, append..

I can’t find the dnsmasq.conf.add file. Where should it be? I thought it was suppose to be in /jffs/configs/

I opened the GUI 384.19 to have a look at the manual assignment list of MAC to IPs and the ‘Enable Manual Assigment’ is toggled to Not but the two client I manually entered earlier are listed.

Does this mean the script is working?
C35770DC-90B4-416C-A107-9320B7A2387B.png
 

EventPhotoMan

Very Senior Member
Update, so I found the dnsmasq.conf.add file.

it was in the /jffs/configs/ directory. Putty was not refreshing the file list. My bad.

so after seeing the file structure of dnsmasq.conf.add, I see why my file was not working (so I thought). The file no longer required a lease time and the host name and IP address Are switch around in order.
So I modified my old dnsmasq.conf.add file and rebooted my modem. The edited dnsmasq.conf.add file should just load in during the router reboot.

Not the case.

Seems like the only static IP address holding are ones that where manually entered. It looks like I cannot append the file manually to addall my clients in.
 

Xentrk

Part of the Furniture
I just ran a test of the functions and had no issues. You'll have to run the script in debug mode and send me the output for further debugging.

The NVRAM Save/Restore utility has better features for saving specific nvram parms. This utility only works for dhcp_hostnames and dhcp_staticlist parms.

HND routers, such as the AC86U model, store dhcp_staticlist and dhcp_hostnames in /jffs/nvram folder rather than in nvram memory. So you won't really gain any space savings moving DHCP static leases to /jffs/confgis/dnsmasq.conf.add file.

Code:
[5] - Disable DHCP Manual Assignment
[6] - Enable DHCP Manual Assignment
[7] - Backup nvram dhcp_staticlist and dhcp_hostnames to /opt/tmp/ and clear nvram values
Where the issue may be is if you select option 5, the dhcp_static assignments are still there. The option did exactly what it says - disable the feature. To clear the static leases from nvram, you have to run option 7.
 

Xentrk

Part of the Furniture
Update, so I found the dnsmasq.conf.add file.

it was in the /jffs/configs/ directory. Putty was not refreshing the file list. My bad.

so after seeing the file structure of dnsmasq.conf.add, I see why my file was not working (so I thought). The file no longer required a lease time and the host name and IP address Are switch around in order.
So I modified my old dnsmasq.conf.add file and rebooted my modem. The edited dnsmasq.conf.add file should just load in during the router reboot.

Not the case.

Seems like the only static IP address holding are ones that where manually entered. It looks like I cannot append the file manually to addall my clients in.
Make sure the permission are correct on the /jffs/configs/dnsmasq.conf.add . Mine are set to 600. -rw------

chmod 600 /jffs/configs/dnsmasq.conf.add

666 should work too
 
Last edited:

EventPhotoMan

Very Senior Member
So, I just started entering in the static addresses in manually. When I’m full I’ll export them out. I’m almost out of IP addresses using /24

what the difference between the files custom_clientlist and dhcp_hostnames?
 

JGrana

Senior Member
Wow, that is a large static list!!!

Since way back, I stopped using the nvram to store any of my static list information. Even before they were moved from nvram to jffs/nvram.

I use dnsmasq.conf.add and hosts.add.

Two nice ascii files, easy to edit and I believe much more portable.

Here is a small helper script once you get your dnsmasq.conf.add file done. I tend to edit dnsmasq.conf.add then forget to update hosts.add... Using this script, I just run it after editting dnsmasq.conf.add then move the file to /jffs/configs/hosts.add.

Hope this saves you any more typing!!!

Updated in later post
 
Last edited:

Jack Yaz

Part of the Furniture
Wow, that is a large static list!!!

Since way back, I stopped using the nvram to store any of my static list information. Even before they were moved from nvram to jffs/nvram.

I use dnsmasq.conf.add and hosts.add.

Two nice ascii files, easy to edit and I believe much more portable.

Here is a small helper script once you get your dnsmasq.conf.add file done. I tend to edit dnsmasq.conf.add then forget to update hosts.add... Using this script, I just run it after editting dnsmasq.conf.add then move the file to /jffs/configs/hosts.add.

Hope this saves you any more typing!!!

Code:
#!/bin/sh
# Generate hosts.add compatible file. Once checked, can be copied to /jffs/configs/hosts.add
if [ -f /jffs/configs/dnsmasq.conf.add ]; then
        echo "dnsmasq.conf found, generating hostnames file"
        cat /jffs/configs/dnsmasq.conf.add | grep '^dhcp-host=' | awk -F"," '{ print $2" "$3; }' > fixhosts
        more fixhosts
        echo "If this file looks good, copy to /jffs/configs/hosts.add"
        echo "Remember to restart dnsmasq to put the changes into effect"
        echo done
else
        echo "No dnsmasq.conf.add file found in /jffs/configs..."
fi
why not have the script ask you if the more output was ok, then copy if you hit "Y"? :)
 

JGrana

Senior Member
Code:
#!/bin/sh
# Generate hosts.add compatible file. Once checked, can be optionaly be copied to /jffs/configs/hosts.add
if [ -f /jffs/configs/dnsmasq.conf.add ]; then
        echo "dnsmasq.conf found, generating hostnames file"
        cat /jffs/configs/dnsmasq.conf.add | grep '^dhcp-host=' | awk -F"," '{ print $2" "$3; }' > fixhosts
        more fixhosts
        echo -n "If this file looks good, enter Y copy to /jffs/configs/hosts.add "
        read -r "confirm"
        case "$confirm" in
                y|Y)
                        cp fixhosts /jffs/configs/hosts.add
                        echo "Copied"
                        echo "A restart of dnsmasq is required for the changes to take effect"
                        echo -n "Enter Y to restart dnsmasq "
                        read -r "confirm2"
                        case "$confirm2" in
                                y|Y)
                                        service restart_dnsmasq >/dev/null 2>&1
                                        echo "Done!"
                                        break
                                ;;
                                *)
                                        echo "Remember to restart dnsmasq or reboot at some point"
                                        break
                                ;;
                        esac
                ;;
                *)
                        echo "Copy the fixhost file to /jffs/configs/hosts.add"
                        echo "Remember to restart dnsmasq to put the changes into effect"
                        break
                ;;
        esac
else
        echo "No dnsmasq.conf.add file found in /jffs/configs..."
fi
LOL, done. I was being lazy ;-) (Stole some code from scmerlin BTW, hey Open Source you know!)
 

EventPhotoMan

Very Senior Member
I use dnsmasq.conf.add and hosts.add.
Two nice ascii files, easy to edit and I believe much more portable.
Here is a small helper script once you get your dnsmasq.conf.add file done. I tend to edit dnsmasq.conf.add then forget to update hosts.add... Using this script, I just run it after editting dnsmasq.conf.add then move the file to /jffs/configs/hosts.add.
So I manually entered as many Static IP address as possible, untill an error message reported my limitation.
When I looked at the dhcp_staticlist file. @RMerlin why is the list of device not is an order? I would prefer it to be in order of IP.

@Xentrk When dnsmasp.conf.add is used, does the router read this file when a new device joins the network, and uses the static list associated to the MAC address? My guess, the router loads in the whole file, thus requiring memory to hold it all, thus creating a limitation.
 
Last edited:

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