Tomato:Backup and Restore config to the same or another router also after nvram reset

Most people know by now that you should never use your old (previous) config file when you upgrade firmware. Often there are conflicting settings and this can result in some very unpredictable results.

Therefore please note:


 * You must erase NVRAM after flashing new firmware versions and reconfigure.


 * You can't use your previous config, as that would be exactly the same as never having erased NVRAM in the first place.

Also:

'''And anyone who has tried it will know that a config file from one router cannot be restored onto another. You have to do it another way.'''

We often want to do this when we buy a new router, for example.

There have been many discussions on how to do this, as normally it's not possible to transfer the config from another router onto a new one. You risk a bricked router if you try editing the file etc. (I know this from experience).

BUT - this is a way to do this which works without the hassle of other methods suggested! You can save the router's configuration in a form where it can be quickly restored to the same or any other tomato router. You do need to "cherry-pick" only the variables that are absolutely necessary to restore.

You need to save a file somewhere on or off the router, with the following command from the command line.

This outputs the complete setup in useable text form, each line beginning with "nvram set". This means it's ready to input to the router without having to add the "nvram set" to every line. You could do this by ssh or telnet.

NOTE - you can only restore the whole config file to the original router. To configure a different router you need to cherry pick the important lines (see below)

e.g.

Or - better still:
THE EASIEST WAY TO USE THIS METHOD - SIMPLE CUT AND PASTE!

If you type "nvram export --set" into the "Tools/System command execution box in Teddy Bear's builds (or any version using it as a base) and click "EXECUTE" - it will give you all variables onscreen. These lines can then be individually cut and pasted into the same or even another router's system box and executed. When you are finished, they can then be committed to NVRAM with NVRAM COMMIT, again in the same system box. If you don't commit them, they will be lost when you reboot the router.

It's actually very easy to set up just the important basic config by hand, but cherry pick only the big variables from the text file that are a real pain to do manually (QOS rules, Static DHCP and Access restriction lists in particular).

You can use GREP to find the settings you need.

e.g: experiment with these to get the feel of it:

NB - This has the added advantage that you don't re-enter any old unused variables from some long forgotten setup. Often you can reclaim several kilobytes of NVRAM. If you are running short on NVRAM space, try doing this to clean up your space. I often recover up to 10K.

You could also use a small script to send the nvram variables file to a PC cifs share every day using the Scheduler e.g. "nvram export --set >/cifs1/routerconfig.txt". So you can't forget to make a copy of your recent settings.

Nowadays I usually get the list up in a browser window, leave it open, and then cut and paste whatever I need into another browser window on the target router.

It's useful to keep a little script in a text file somewhere so that when you need it, you can collect the relevant details easily by pasting into the system box and execute. Here is one that grabs almost everything I need, for example.

Try it! It's a doddle... Less than 5 minutes to transfer everything I need and configure a new router.