Thanks!nvram get dhcp_staticlist
nvram get dhcp_staticlist > dhcp_staticlist.txt
nvram set dhcp_staticlist="<PASTE_STATIC_LEASES_HERE>"
nvram commit
reboot
Because it can sometimes be difficult entering a very long line without it being truncated you can use this method instead.next open the text file, copy the contents (everything should be on one line) and run the following commands to restore:
nvram set dhcp_staticlist="$(cat dhcp_staticlist.txt)"
nvram commit
Because it can sometimes be difficult entering a very long line without it being truncated you can use this method instead.
Another consideration is that the router's input buffer is only 1022 characters, so any line longer than that will be truncated. I currently have 17 entries in my DHCP list which takes up 673 characters in NVRAM.As a Notepad++ user (when on my Windows laptop) I don't have any issues with truncated lines
Another consideration is that the router's input buffer is only 1022 characters, so any line longer than that will be truncated. I currently have 17 entries in my DHCP list which takes up 673 characters in NVRAM.
The input buffer only applies when trying to manipulate from the command line. If you want to see, create a simple script with an echo "string" command where string is some really long string greater than 1022 characters.Good to know, wasn't aware of that. I currently have 23 entries in my list, I think... I need to check how much characters it is. By 'input buffer' you mean what's pasted (or typed) in a terminal I assume? Otherwise backup scripts like John's would have an issue with larger sets of static leases as well. I don´t know whether there's a max number of reservations you can assign?
/tmp/var/lib/misc/dnsmasq.leases
/***/hosts.dnsmasq
Of interest are also:
***=etc*Code:/tmp/var/lib/misc/dnsmasq.leases /***/hosts.dnsmasq
*) or else this post is blocked by the smart filter.
./save-mynram.sh dhcp_staticlist
./save-mynvram.sh dhcp_staticlist
I moved this list out of nvram by putting the static list into a jffs maintained config fileAnother consideration is that the router's input buffer is only 1022 characters, so any line longer than that will be truncated. I currently have 17 entries in my DHCP list which takes up 673 characters in NVRAM.
admin@RT-N66U-25A0:/jffs/configs# cat dnsmasq.conf.add
# Appended to dnsmasq.conf automatically, or if done by hand, restart the service with
# $ service restart_dnsmasq
#
# generated from GUI settings via the command
# nvram get dhcp_staticlist | sed 's/</\n/g' | awk -F '>' '/>/ { print "dhcp-host=" $1 ($3 ? ("," $3) : "") "," $2 }' >> /jffs/configs/dnsmasq.conf.add
#
dhcp-host=00:08:9B:C0:81:5E,homenas,192.168.1.200
dhcp-host=E8:94:F6:EC:3D:11,tplink801-1,192.168.1.100
...
Welcome To SNBForums
SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.
If you'd like to post a question, simply register and have at it!
While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!