1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
Dismiss Notice

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!

User NVRAM Save/Restore Utility (R26.2)

Discussion in 'Asuswrt-Merlin' started by john9527, Sep 15, 2014.

  1. john9527

    john9527 Part of the Furniture

    Joined:
    Mar 28, 2014
    Messages:
    5,640
    Location:
    United States
    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: Oct 25, 2017
    Quoc Huynh, Rolo, XabiX and 52 others like this.
  2. Please support SNBForums! Just click on this link before you buy something from Amazon and we'll get a small commission on anything you buy. Thanks!
  3. JGrana

    JGrana Regular Contributor

    Joined:
    May 31, 2013
    Messages:
    182
    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.
     
  4. john9527

    john9527 Part of the Furniture

    Joined:
    Mar 28, 2014
    Messages:
    5,640
    Location:
    United States
    Just a bump for a release update. Details in the first post.
     
  5. greggy101

    greggy101 Regular Contributor

    Joined:
    Oct 12, 2012
    Messages:
    110
    Location:
    Oregon
    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.
     
  6. john9527

    john9527 Part of the Furniture

    Joined:
    Mar 28, 2014
    Messages:
    5,640
    Location:
    United States
    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.
     
  7. greggy101

    greggy101 Regular Contributor

    Joined:
    Oct 12, 2012
    Messages:
    110
    Location:
    Oregon
    No luck with r3
    all I get is "nvram-restore-20141028-.sh"
    Got to go get more sticks :)

    BTW- thanks for this nice utility!
     
  8. cofetym

    cofetym Regular Contributor

    Joined:
    Dec 23, 2013
    Messages:
    176
    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.;)
     
  9. oversim

    oversim Regular Contributor

    Joined:
    Aug 1, 2013
    Messages:
    136
    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?
     
  10. Martineau

    Martineau Very Senior Member

    Joined:
    Jul 8, 2012
    Messages:
    1,788
    Location:
    UK
    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,
     
  11. john9527

    john9527 Part of the Furniture

    Joined:
    Mar 28, 2014
    Messages:
    5,640
    Location:
    United States
    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.

    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.

    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.
     
  12. john9527

    john9527 Part of the Furniture

    Joined:
    Mar 28, 2014
    Messages:
    5,640
    Location:
    United States
    Third times a charm :eek: .....attachment replaced with r3a. Verified that the MAC address gets correctly added on AC87.
     
  13. HardCat

    HardCat Regular Contributor

    Joined:
    Sep 14, 2013
    Messages:
    120
    Location:
    Nova Scotia, Canada
    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?
     
  14. john9527

    john9527 Part of the Furniture

    Joined:
    Mar 28, 2014
    Messages:
    5,640
    Location:
    United States
    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: Oct 30, 2014
  15. sammarbella

    sammarbella Occasional Visitor

    Joined:
    Oct 14, 2014
    Messages:
    27
    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!
     
  16. ocram59

    ocram59 Regular Contributor

    Joined:
    Feb 21, 2013
    Messages:
    67
    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
     
  17. john9527

    john9527 Part of the Furniture

    Joined:
    Mar 28, 2014
    Messages:
    5,640
    Location:
    United States
    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)
     
  18. ocram59

    ocram59 Regular Contributor

    Joined:
    Feb 21, 2013
    Messages:
    67
    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
     
  19. rtcomputersinc

    rtcomputersinc Senior Member

    Joined:
    Dec 6, 2013
    Messages:
    222
    This is awesome. I have 8 routers 66u/68u/87u and it kills me to have to recreate these each time I update them. Thank you!!!
     
  20. cyborgpunte

    cyborgpunte Regular Contributor

    Joined:
    Feb 14, 2014
    Messages:
    138
    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
     
  21. tsunami2311

    tsunami2311 Senior Member

    Joined:
    Apr 25, 2013
    Messages:
    452
    I vote this to become sticky
     
Please support SNBForums! Just click on this link before you buy something from Amazon and we'll get a small commission on anything you buy. Thanks!