What's new

User NVRAM Save/Restore Utility (R26.2)

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

Status
Not open for further replies.

john9527

Part of the Furniture
LATEST RELEASE: Release 26.2
22-September-2017
nvram-save-r26.2.zip
Download http://bit.ly/2aaAySO
===============================

Version 26.2 Highlights (Full Changelog history is available in the download directory)
Program Changes
  • Corrects a problem where variables marked for a forced restore may not be restored
  • Users should do a fresh save after upgrading.
Version 26.1 Highlights
Program Changes
  • Update prompts during jffs-restore to better address migrations
  • Process tagged vars that need to have empty values saved/restored
  • Add support for separate user variable adds via nvram.ini.add
INI file changes
  • Tag dsn_probe and dns-filter vars for forced save/restore even if empty
  • Resync with new adds for 380.68


Version 26.0 Highlights
Program Changes
  • Change version numbering scheme - @dvohwinkel
  • Warn when current router MAC does not match latest save MAC instead of aborting - @martinr
  • Improve checking for ability to do a migrate restore from a full save
    NOTE: With this change, you must have done a full save on R26.0 or later to also do a migration restore from the same file. If a migration restore is not possible, a message will be displayed during the nvram-restore. It is recommended to do a full save after installing R26.0 if you wish to use this option.
INI file Changes
  • Sync with Merlin 380.68 and Fork V27 release
  • Force save a transient QoS var not present after a factory reset - @ColinTaylor, @cybrnook
  • Fix FTP enabled state after a restore - @ColinTaylor

Some quick usage notes:
  • Basic help is available by entering './nvram-save.sh -h'
    Code:
    NVRAM User Save/Restore Utility
    nvram-save.sh Version 26.0
     Options: -h           this help msg
              -v           Print version/perform consistency check
              -b           Backup mode - save for restore to same router (default)
              -m           Migration mode - transfer settings to another router
              -i inifile   Specify custom nvram variable ini file
              -clk         Include clkfreq/overclock setting (Backup mode only)
              -nojffs      Skip backup of jffs storage
              -nouser      Skip execution of user exit script
  • When running the utility or using the print version option, nvram-save.sh, nvram-restore.sh, jffs-restore.sh, nvram-merlin.ini and nvram-excp-merlin.sh are consistency checked to make sure they are all the same version. A WARNING message will be printed on a version mismatch, but execution will continue if actually running to generate the restore script.
  • You can now specify a custom nvram variable 'ini' file to use to generate the restore script. A sample ini,
    nvram-sample.ini, is included which is a stripped down version of the full ini containing only basic entries that people
    have mentioned in various threads.
  • The backup files may now be placed in a 'backup' subdirectory. Just 'mkdir /mnt/ASUS/backup' and the files will be placed there instead of in the main working directory.
  • The default state is NOT to save clkfreq overclocking values (safest when moving to a new code level). If you wish to
    include this setting, specify the -clk option on the nvram-save.sh command.
  • The nvram-merlin.ini files contains a section at the end for custom User Adds. You may edit this section to add any NVRAM variables you may have created for use in scripts, or to temporarily add any variables which may be missing.
  • The nvram-save utility also creates two text files during execution that can be viewed or archived.
    • nvram-all-yyyymmddhhmm-macid.txt (all nvram variables, including system variables not normally changed by the user)
    • nvram-usr-yyyymmddhhmm-macid.txt (the nvram variables actually saved by the utility in their save categories)
  • The utility is still valid for ASUS OEM as well as Merlin releases, although it will not attempt to fix changes in the use of nvram variables between releases (just too many ASUS levels with various release numbers to track).
-----------------------------------------------------------------
SHA256 hash:

Code:
6cf18e1f93d4b8eb4b768a56e8aca3e676630192ebcb15834577face4b8e9263  nvram-save-r26.2.zip

Thanks again to everyone for their feedback and suggestions. Enjoy!
 
Last edited:
Works well

Very nice utility.

One change I made. Based on the newer Asus and AsusMerlin firmwares, I have added the following under [DHCP Settings]:

custom_clientlist

This saves the icons for the Clients when viewed from the Network Map page.
 
For some strange reason it saved the file without the last macid...
Instead of "nvram-restore-yyyymmdd-macid.sh" all I have is "nvram-restore-yyyymmdd-.sh" This is on AC87U.

I guess I will have to have a separate USB stick for every router.
 
For some strange reason it saved the file without the last macid...
Instead of "nvram-restore-yyyymmdd-macid.sh" all I have is "nvram-restore-yyyymmdd-.sh" This is on AC87U.

I guess I will have to have a separate USB stick for every router.

I just bought stock in a USB stick company :)

Seriously, thanks for the feedback....who would have thought they would have changed where I get that value from. Just changed the attachment to r3....should fix the macid for AC87. No other changes.
 
No luck with r3
all I get is "nvram-restore-20141028-.sh"
Got to go get more sticks :)

BTW- thanks for this nice utility!
 
John has done a great job with this utility. I decided to attach a USB stick to each of my routers. I was not using the USB slots for anything anyway.
I really appreciate the time and dedication of the great IT guys that give so much of their time on this forum.;)
 
First of all, thanks ;)
So, what are the differences between a reset to factory and a restore using this script and a reset to factory and a restore using the save configuration option in the firmware?
 
First of all, thanks ;)
So, what are the differences between a reset to factory and a restore using this script and a reset to factory and a restore using the save configuration option in the firmware?

Using a script to restore the configuration is portable i.e. it will safely work on any Asus router, so if you had an RT-N66U and then bought an RT-AC68U, then you could quickly clone your working custom settings to the new hardware.

Restoring a .CFG file to a different physical router (or even the same one with with a different firmware) is bad.
i.e. the .CFG binary contains low level settings such as the MAC address etc.

NOTE: If Asus ever decide to rename any of the NVRAM settings or format/interpret them differently in the GUI then the script restore may then also be inappropriate!

Regards,
 
Using a script to restore the configuration is portable i.e. it will safely work on any Asus router, so if you had an RT-N66U and then bought an RT-AC68U, then you could quickly clone your working custom settings to the new hardware.

If you are using this to 'clone' to new hardware, make sure that both routers aren't on the network at the same time. The save includes router ip address, SSIDs, port forwards, etc. and having duplicates on your network would be a bad thing.

Restoring a .CFG file to a different physical router (or even the same one with with a different firmware) is bad.
i.e. the .CFG binary contains low level settings such as the MAC address etc.
One of the big things included in the .cfg are the low level setting for the wireless. That's why it's often recommended to do a factory reset after a code load to make sure these get updated for the new code. With this utility, you can then restore the 'stuff' you manually enter into the gui.

NOTE: If Asus ever decide to rename any of the NVRAM settings or format/interpret them differently in the GUI then the script restore may then also be inappropriate!

True enough....I'd be careful about using this to make a big jump in code levels. I don't think it will hurt anything and things have been pretty consistent in the gui, but you should always review things afterwards to make sure everything looks correct.
 
No luck with r3
all I get is "nvram-restore-20141028-.sh"
Got to go get more sticks :)

BTW- thanks for this nice utility!

Third times a charm :eek: .....attachment replaced with r3a. Verified that the MAC address gets correctly added on AC87.
 
John, first off thanks for this great much needed utility!

I was perusing the "nvram.ini" file and noticed under the section [IPTV Settings], "switch_stb_x" is there twice. Is there a reason for that?
 
John, first off thanks for this great much needed utility!

I was perusing the "nvram.ini" file and noticed under the section [IPTV Settings], "switch_stb_x" is there twice. Is there a reason for that?

Uhhh.....oops. No special reason other than I missed the duplicate. I'll pull it on the next update (won't hurt anything in the meantime).

A little background for anyone who is interested. The generation of the ini file was the difficult part of all this. What I did was write some 'throw away' code that scanned the source for all of the gui web pages for references to nvram variables. Then, since they do sometimes move things from one page to another, I decided to try and group them more by function, using the web pages as a reference, then scan to try and remove the duplicates (obviously missed one in this step).

Also, just for everyone's info, right now the Wireless/Professional page isn't covered so that one will need to be redone by hand. I can't quite remember why I didn't include it first time around, but I'll take another look for the next update.

Edit - I remember now why I didn't include the Wireless/Professional....quite a few of these are things that are likely to change if you were to use the utility to migrate to a different router and probably want to start with the defaults.
 
Last edited:
User NVRAM Save/Restore Utility

Version 3a now attached
- Fix getting MAC address for AC87 routers

Version 2
- Adds the last two bytes of the router MAC address to the restore script name so multiple routers can have their settings stored on the same USB stick.
- Includes a step-by-step QuickStart.txt file for use with a USB stick.
- Adds custom_clientlist to the saved nvram vars (Thanks JGrana)

-----------------------------------------------------------------

Watching the threads, it seems as if there are continued questions concerning saving/restoring parts of the user configuration if a factory reset needs to be done. There have been a couple of solutions offered over time, but nothing that has had any staying power.

So...I've created a simple script (using some of the previous ideas) that reads a configuration (ini) file that lists by category the nvram variables associated with parts of the user configuration and creates a restore script for those variables. If the variable doesn't exist or is null no restore action is created.

The script (nvram-save.sh) and ini file (nvram.ini) just need to be in copied to the same user accessable directory on the router and the script marked as executable. I've now included a QuickStart.txt file inside the zip that goes step-by-step on how to use a USB stick with the utility.

The format of the ini file is pretty self explanatory, so hopefully the forum users can post their own updates for the ini that they find useful. The header of the ini also describes how to exclude specific variables or entire sections if you want.

The sequence would be
- Do a save configuration from the router Administration gui (as a backup)
- Run the nvram-save.sh script
- Reset to factory defaults / reboot
- Run the created nvram-restore-yymmdd-macid.sh script
- Reboot

Bumping the thread to say thank you! :)

I've just transfered the router settings from my old RT-N16 to my new RT-AC87U in a few minutes using your script.

It saves me a lot of time avoiding to setting up from scratch.

Only wireless settings was left out but this only takes a few minutes to setup.


Many kudos to you!
 
Thank you very much John greaat work !!

I added the following values to nvram.ini

st_samba_mode
st_samba_force_mode

They rule how Samba share is managed (Guest or not)

Thanks again
Ocram
 
Bump for an update.....thanks for the responses and happy you are finding this useful!

Version 4
- Add Wireless-Professional section
- Add Guest Network section
- Add Switch Control section
- Add SAMBA access vars - by ocram59
- Add FTP access vars
- Add Migration mode to exclude some vars - runtime switch -M (nvram-save.sh -M)
 
Hello John

I added to nvram.ini the following section to save QoS Settings


[QOS Settings]
qos_reset
qos_irates
qos_rst
qos_inuse
qos_rulelist
qos_sticky
qos_orules
qos_ibw
qos_type
qos_syn
qos_ack
qos_burst0
qos_burst1
qos_method
qos_icmp
qos_enable
qos_obw
qos_default
qos_orates
qos_fin
qos_rulenum_x

=============


Best Regards and thanks again
Ocram
 
Thanks for great scripts, helped me a lot.

But What are these two values used to ??
wan0_routing_isp="**masked**"
wan1_routing_isp="**masked**"

And there are several *modem* variables missing in my dualwanconfig.
such as
modem_isp=Masked
usb_modem_act_int=ttyUSB0


TIA
BR
 
Status
Not open for further replies.

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

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