Best Way to Backup Changed Settings / Configuration Only

Discussion in 'Tomato Firmware' started by Boktai1000, Feb 9, 2019.

  1. Boktai1000

    Boktai1000 Network Guru Member

    Hello,

    I am inquiring to find out what is the best way to capture only settings that have been changed from the default options, and if that is even possible?

    My goal here is to build out a "nvram settings" config cheat sheet to have on hand any time I do an NVRAM erase, so that I'm able to quickly apply my configuration back to the router. I would prefer not to simply reapply an NVMRAM config restore, but instead apply one line (or multiple lines) copy/pasted back into the CLI to apply the settings.

    In addition I have previously always configured my settings through the GUI. I would like to learn the command line equivalent of these settings and be more familiar with the NVRAM equivalent options.

    If it is not possible to export only changed settings, what would be the best way for me to capture changes that I've made already, especially if I'm unsure all of the changes and wanted to make sure I captured everything?

    Any good resources or tips and tricks, or ways other users are doing this would be appreciated as I don't necessarily want to re-invent the wheel here.

    Thank you
     
  2. JeffD

    JeffD Serious Server Member

    First off, I love the idea. But you may be barking up the wrong tree. The NVRAM tools support an export which generates the SET command used for setting the values. So, you run this on your router pipe that to a file and then save that file off for if you need to restore. I think it's just that simple. There's no harm setting the default value to the default values, it's basically a no-cost thing to do.

    You can do something like this from the shell which generates a list of set commands which can be used to restore settings. If you pipe this to a file and save that you can restore NVRAM executing that those commands:
    Code:
    nvram export --set
    There's also a --nodefaults option which I think may do what you want, but I'm no expert on the nvram tool.
    Code:
    nvram export --set --nodefaults
    My --nodefaults run was roughly 1000 less lines of values, but I have no way of knowing if this is what you're really looking for.
    EDIT: After looking at the nvram source code it looks like this will do what you want because before exporting the value it compares it against the default defined in firmware. You may still want to test it, but I think it's what you're looking for.

    The place where I ran into problems is that I'd like to do something similar except clone settings from router1 to router2. This gets a little more difficult because there are device specific values (MAC, Serial Number, Model Number, etc) which shouldn't be changed from the values populated by default.


    The other option I was thinking tp suggest would work if you're a programmer.... You could use your export file and with python or perl or some other language write a script which would compare your exported values against the defaults defined in defaults.c file for your firmware's source code to see what's different.
     
    Last edited: Feb 10, 2019
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice