What's new

Adding NvRam settings.

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

NeutralGold

Regular Contributor
So I finally ran into a problem after not ever clearing my nvram settings over many firmware updates. I decided it was time to clear my nvram and add my settings manually using nvram commits.

My dhcp static list is pretty long and ends up being one long line. My QoS settings line is just as long.

Every time I try to add them both, I get a sytax error.
-sh: syntax error: unexpected redirection

Anyone know what I'm doing wrong?
Or explain how I can go about doing this properly?
I can't figure out why, but I completely lose internet access to my devices with my previous settings. I did how ever manage to load an earlier settings file and it's working fine but I don't really care to leave it as is.
Thanks
 
So I finally ran into a problem after not ever clearing my nvram settings over many firmware updates. I decided it was time to clear my nvram and add my settings manually using nvram commits.

My dhcp static list is pretty long and ends up being one long line. My QoS settings line is just as long.

Every time I try to add them both, I get a sytax error.
-sh: syntax error: unexpected redirection

Anyone know what I'm doing wrong?

Don't forget to use quotes, otherwise the shell will try to process those > as if they were redirections.

Code:
nvram set dhcp_staticlist="blah>blah>blah>"
 
Don't forget to use quotes, otherwise the shell will try to process those > as if they were redirections.

Code:
nvram set dhcp_staticlist="blah>blah>blah>"

Thanks Merlin, I'll give it a shot in the morning. Nice work on the latest firmware too.
 
Code:
nvram set dhcp_staticlist="blah>blah>blah>"

Besides, the text should start with a leading "<" :) :

Code:
nvram set dhcp_staticlist="<XX:XX:XX:XX:XX:XX>192.168.x.x>blahblah>XX:XX:XX:XX:XX:YY>192.168.x.y>bluhbluh"
 
Besides, the text should start with a leading "<" :) :

Code:
nvram set dhcp_staticlist="<XX:XX:XX:XX:XX:XX>192.168.x.x>blahblah>XX:XX:XX:XX:XX:YY>192.168.x.y>bluhbluh"

Yep, took all but 5 minutes to add my settings from exported nvram settings after you guys told me about the quotes.
That's gonna save me loads of time in the future.

Speaking of which, I just saved 3KB worth of space on nvram settings. That's from an old settings file too. Had it been the latest broken one, it would have been about 8 KB's worth. Definitely worth it.

Thanks you guys.
 
Last edited:
Can somebody post a real example of this command? I cannot figure out exactly how to use it with all the 'blah, blahs' inserted.

Thanks

DrT
 
Can somebody post a real example of this command? I cannot figure out exactly how to use it with all the 'blah, blahs' inserted.

Thanks

DrT

I think I repost this one every month :( Try a forum search on "dhcp_staticlist", I'm too lazy to do it again, sorry.
 
Can somebody post a real example of this command? I cannot figure out exactly how to use it with all the 'blah, blahs' inserted.

Thanks

DrT

A previous Merlin post:

1) Display the nvram setting:

Code:
nvram get vts_rulelist
nvram get dhcp_staticlist
Note down the resulting output.

2) Flash, then reset.

3) Enable SSH, then re-enter your setting, like this (putting your noted down settings between " "):

Code:
nvram set vts_rulelist="<PC1>600:601>192.168.1.100>>BOTH<PC2>610:619>192.168.1.101>>BOTH"
nvram set dhcp_staticlist="<08:00:27:66:44:33>192.168.1.100>PC1"
nvram commit
 
From another RMerlin previous post, an example that doesn't require you to retype all the values....

This requires a usb flash drive; replace "sda1" as needed for your particular drive.

Save values:
nvram get vts_rulelist > /mnt/sda1/portlist.txt
nvram get dhcp_staticlist > /mnt/sda1/dhcp.txt

Restore values:
nvram set vts_rulelist="`cat /mnt/sda1/portlist.txt`"
nvram set dhcp_staticlist="`cat /mnt/sda1/dhcp.txt`"
nvram commit
 
I think I repost this one every month :( Try a forum search on "dhcp_staticlist", I'm too lazy to do it again, sorry.

Hi, my reply did not make it to the board. Thanks for pointing me in the right direction...I found much more useful information than I originally requested :).

Thanks too to 'ScottW' and 'crazyea'.

All info screenshotted and filed away.

Regards

DrT
 
Last edited:
Yes very helpful, to me as well. It's turned into a daily activity for me to visit this board. Most everyone here is super helpful. I try to help when I can as well.

Thanks folks.
 
I want to eventually include two simple script in the firmware that would allow one to save and restore some of those settings to save time when reconfiguring after a factory default reset. The scripts would take care of QoS, DHCP static leases, etc... I just haven't gotten around to it yet.
 
I want to eventually include two simple script in the firmware that would allow one to save and restore some of those settings to save time when reconfiguring after a factory default reset. The scripts would take care of QoS, DHCP static leases, etc... I just haven't gotten around to it yet.

That would be worth a further donation :) - a BIG plus indeed.

DrT
 
From another RMerlin previous post, an example that doesn't require you to retype all the values....

This requires a usb flash drive; replace "sda1" as needed for your particular drive.

Save values:
nvram get vts_rulelist > /mnt/sda1/portlist.txt
nvram get dhcp_staticlist > /mnt/sda1/dhcp.txt

Restore values:
nvram set vts_rulelist="`cat /mnt/sda1/portlist.txt`"
nvram set dhcp_staticlist="`cat /mnt/sda1/dhcp.txt`"
nvram commit

That's very helpful, thanks!

I have tried to also save parental control rules in the same way but can't figure it out. Is there a command I can use to dump the parental controls as a txt file for later importing back into the nvram?
 
I want to eventually include two simple script in the firmware that would allow one to save and restore some of those settings to save time when reconfiguring after a factory default reset. The scripts would take care of QoS, DHCP static leases, etc... I just haven't gotten around to it yet.

Here is the list of some of the variables to save. am i missing stuff?

I am missing Qos, but i don't use that so don't know where to look.

vts_rulelist
dhcp_staticlist
lan_ipaddr_rt
dhcp_start
dhcp_end
rstats_path
ntp_server0
computer_name
wl0_ssid
wl_ssid
wl1_ssid
wl_wpa_psk
wl0_wpa_psk
wl1_wpa_psk
 
So i have this script

#!/bin/sh

echo "#!/bin/sh"
echo nvram set vts_rulelist=\"`nvram get vts_rulelist`\"
echo nvram set dhcp_staticlist=\"`nvram get dhcp_staticlist`\"
echo nvram set lan_ipaddr_rt=\"`nvram get lan_ipaddr_rt`\"
echo nvram set dhcp_start=\"`nvram get dhcp_start`\"
echo nvram set dhcp_end=\"`nvram get dhcp_end`\"
echo nvram set wan_dns=\"`nvram get wan_dns`\"
echo nvram set wan0_dns=\"`nvram get wan0_dns`\"
echo nvram set wan0_dns1=\"`nvram get wan0_dns1`\"
echo nvram set wan0_dns2_x=\"`nvram get wan0_dns2_x`\"
echo nvram set wan0_dnsenable_x=\"`nvram get wan0_dnsenable_x`\"
echo nvram set rstats_path=\"`nvram get rstats_path`\"
echo nvram set ntp_server0=\"`nvram get ntp_server0`\"
echo nvram set computer_name=\"`nvram get computer_name`\"
echo nvram set wl0_ssid=\"`nvram get wl0_ssid`\"
echo nvram set wl_ssid=\"`nvram get wl_ssid`\"
echo nvram set wl_auth_mode_x=\"`nvram get wl_auth_mode_x`\"
echo nvram set wl1_ssid=\"`nvram get wl1_ssid`\"
echo nvram set wl1_akm=\"`nvram get wl1_akm`\"
echo nvram set wl_wpa_psk=\"`nvram get wl_wpa_psk`\"
echo nvram set wl0_wpa_psk=\"`nvram get wl0_wpa_psk`\"
echo nvram set wl1_wpa_psk=\"`nvram get wl1_wpa_psk`\"
echo nvram set usb_idle_timeout=\"`nvram get usb_idle_timeout`\"
echo nvram set http_username=\"`nvram get http_username`\"
echo nvram set http_passwd=\"`nvram get http_passwd`\"
echo nvram set misc_httpsport_x=\"`nvram get misc_httpsport_x`\"
echo nvram set https_lanport=\"`nvram get https_lanport`\"
echo nvram set login_port=\"`nvram get login_port`\"
echo nvram set wl_chanspec=\"`nvram get wl_chanspec`\"
echo nvram set wl1_chanspec=\"`nvram get wl1_chanspec`\"
echo nvram set sshd_enable=\"`nvram get sshd_enable`\"
echo nvram set ddns_hostname_x=\"`nvram get ddns_hostname_x`\"
echo nvram set ddns_status=\"`nvram get ddns_status`\"
echo nvram set ddns_server_x=\"`nvram get ddns_server_x`\"
echo nvram set ddns_enable_x=\"`nvram get ddns_enable_x`\"

Which will create another file with the nvram settings

so you do this (save above script in a file called save_nvram.sh)

then at a prompt

sh save_nvram.sh > /mnt/Disk/save_nvram.sh

do the clear nvram stuff


mtd-erase -d nvram
nvram commit

then

sh /mnt/Disk/save_nvram.sh
nvram commit

I haven't tried this on the router yet, just want to see what everyone thinks about this. I do want to clear the nvram stuff out but i don't want to have to manually put everything back.

i think???? i got most of them anyone see what might be missing?
 
Last edited:
You'll want all those that start with MULTIFILTER if you also to save the Parental Control rules.

Ultimately, such a script will need to be more flexible in letting you specify which "services" you want to save. That's why I haven't had time to get around to work on it yet.
 
You'll want all those that start with MULTIFILTER if you also to save the Parental Control rules.

Ultimately, such a script will need to be more flexible in letting you specify which "services" you want to save. That's why I haven't had time to get around to work on it yet.

This is meant to be a start, and it only really covers simple uses, doesn't save Parental Controls, vpn etc.

The problem with all of this is its hard to figure out which are needed and which are not.
 
This is meant to be a start, and it only really covers simple uses, doesn't save Parental Controls, vpn etc.

The problem with all of this is its hard to figure out which are needed and which are not.

I agree, this isn't as easy as it might seem.

That wasn't meant as a criticism BTW, just tossing out these settings because I know someone else will ask for them :)
 

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