I'm very grateful for the work that has been done on this script. I decided that for my setup it was more convenient to mount my server share on the router and run the script directly from the server. That avoids the need for adding anything to the router, assuming that the version being used supports mounting a samba share.
I've already used the script to copy some port forwarding data from one router to another. It worked as expected, although the GUI on the target router didn't reflect the additional routes until I clicked on Add, at which point each of the additional routes showed itself, one for each click. That's on DD-WRT v24-sp2 (12/15/14) big - build 25648 on Netgear WNR3500L routers
I've just found that one of my routers doesn't have the tee command. It's a WNDR3700 v4 running DD-WRT v24-sp2 (04/01/15) std - build 26635. The only reason I mention is so that if anyone else finds that they want to use the script and they don't have tee, they can overcome the problem by changing the tee lines into duplicate commands with the output going to the individual files.
Might that be a slightly better option to allow for builds which don't have tee?
Is there anyway to get this script to work with rsync or an encrypted connection rather than plain FTP? _________________ Buffalo WZR-HP-AG300H: DD-WRT v3.0-r32170 std (06/01/17)
I keep getting ./backup-settings.sh: line 132: tee: not found. Is there a package for tee for Atheros AR7161 rev 2 based routers as I can't seem to find one on the openwrt repo. _________________ Buffalo WZR-HP-AG300H: DD-WRT v3.0-r32170 std (06/01/17)
Joined: 19 May 2017 Posts: 20 Location: TN<>MI, US
Posted: Mon May 22, 2017 16:40 Post subject:
This thread died off after much of the logic was put into the web interface. But it's still widely linked and comes up tops (or high) in searches. So as a public service, here's an offering of the current status:
For simple upgrades of the same firmware on the same device, just use the web GUI: Administration | Backup, Backup, then flash upgrade, then Restore. No need for scripts or to go manually page-by-page. (Restoring earlier backups used to be a caveat; not anymore.)
Clear text NVRAM backups can still be made the old way: nvram show > nvram.txt
To transfer existing settings quickly from one device to another, this script can be tried. Success is not assured and difficulties are to be expected.
Now if someone could figure out how to bring back the beloved frater, who started this thread long ago... _________________ My old self (phonetics-R-fun)
So after coming across this thread and looking elsewhere I found a github repo that saved a version and has been updating it (last update was 10 months ago as of this post). I figured I'd share my method to get this to work on my router. Minimal Linux/shell experience required.
I logged onto router usint PuTTY SSH access and ran the following code, once I had Entware and /opt on the USB (not sure if necessary but it works).
#works with Entware setup on USB
curl -LJO https://raw.githubusercontent.com/slycordinator/dd-wrt.backupessential/shellcheck_cleanup/backupessential > /opt/usr/sbin/backupessential
curl -LJO https://raw.githubusercontent.com/slycordinator/dd-wrt.backupessential/shellcheck_cleanup/vars_to_skip > /opt/usr/sbin/vars_to_skip
curl -LJO https://raw.githubusercontent.com/slycordinator/dd-wrt.backupessential/shellcheck_cleanup/vars_to_include > /opt/usr/sbin/vars_to_include
curl -LJO https://raw.githubusercontent.com/slycordinator/dd-wrt.backupessential/shellcheck_cleanup/vars_preferred > /opt/usr/sbin/vars_preferred
#run backup script and backup to /opt/home/backup_files
sh /opt/usr/sbin/backupessential -d /opt/home/backup_files
Then in a command window on the computer I ran.
Code:
#copy backup script files to computer with scp (run scp on computer) and replace ***ROUTER_IP*** with actual router IP
scp root@***ROUTER_IP***:/opt/home/backup_files/* ./backup_files
I now have backup .sh files on both my USB drive, and on my computer that are time and date stamped.
Maybe there's a better way, but this took me a minute to figure out so I thought I'd share in case it's useful for anyone who wants a straightforward way to do this.
Joined: 16 Nov 2015 Posts: 6411 Location: UK, London, just across the river..
Posted: Mon Jun 20, 2022 20:40 Post subject:
im not sure if its a good idea to save back up and restore on different hardware at all...may be if you save only the essentials that are common between all the possible builds(consider 4MB, 8MB, 16MB and 32+ flash size)...than it may work but you still have to restore or make some other functions to work...
even restoring same builds on 2 same router models same hardware...its a bit risky due to a bad blocks in the ram...for example R7800 to R7800 or 1043v2>1043v2...not that i have not done it..but its not a good idea.. ...especially on R7800 where those are known with bad blocks in memory..
the best i do is usually based on those commands:
nvram backup /opt/store/1043v2.bin
nvram restore /opt/store/1043v2.bin
or
nvram show > /opt/bckup/nvram_output.txt than either read with nano or vi or WSCP to PC and read there
there are indeed few scripts that kind of work, but no idea how they handle the new mem locations and ect. when those happen on a new builds..
bear in mind, some variables and functions could be removed or relocated on a new/different builds and thus is why reset after update and manual rebuild is required...at least this is my poor understanding of back ups and restore...
i guess someone will chime in to say something else more valuable on the subject... _________________ Atheros
TP-Link WR740Nv1 ---DD-WRT 55179 WAP
TP-Link WR1043NDv2 -DD-WRT 55303 Gateway/DoT,Forced DNS,Ad-Block,Firewall,x4VLAN,VPN
TP-Link WR1043NDv2 -Gargoyle OS 1.15.x AP,DNS,QoS,Quotas
Qualcomm-Atheros
Netgear XR500 --DD-WRT 55460 Gateway/DoH,Forced DNS,AP Isolation,4VLAN,Ad-Block,Firewall,Vanilla
Netgear R7800 --DD-WRT 55460 Gateway/DoT,AD-Block,Forced DNS,AP&Net Isolation,x3VLAN,Firewall,Vanilla
Netgear R9000 --DD-WRT 55363 Gateway/DoT,AD-Block,AP Isolation,Firewall,Forced DNS,x2VLAN,Vanilla
Broadcom
Netgear R7000 --DD-WRT 55460 Gateway/SmartDNS/DoH,AD-Block,Firewall,Forced DNS,x3VLAN,VPN
NOT USING 5Ghz ANYWHERE
------------------------------------------------------
Stubby DNS over TLS I DNSCrypt v2 by mac913
Last edited by Alozaros on Mon Jun 20, 2022 22:04; edited 1 time in total
Same router model to same router model is benign, unless you can infallibly prove otherwise instead of using speculation and conjecture that may result in misinformation.
Of course, this thread is ancient history, but I can't fathom any reason why anyone would want to transfer Broadcom nvram vars to Atheros or any such risky venture. The original premise was probably between different Broadcom routers (?)
My use case was far less controversial than trying to move settings from a Broadcom router to an Atheros. I was looking for a good way to backup *text* nvram commands as I'm trying to get VAP VPN routing working while also having a way to preserve settings through upgrades since it seems to be the consensus that restoring a bin backup after an upgrade can lead to bricking the router.
From the sticky thread above this message this tool is available:
Which says it will let you convert your binary backup files to text nvram commands, but it seems that the advantage of the script is you can designate variables to ignore.
This script in this thread by frater and others was apparently included in OTRW (https://infodepot.fandom.com/wiki/Backup_settings_and_restore_them) but I have Entware loaded and couldn't find a version there.
So to summarize, although this thread is old, it does still seem to contain the most comprehensive way to backup nvram settings as text while controlling variables to include.
If there is another more current way to do that it would be great to redirect me and others to it, otherwise again, perhaps my contributions are accessible and useful in some cases.
OTRW is also ancient history and deprecated; I am failing to grasp the connection to Entware in this whole premise (?). Please don't take my commentary as dismissive or not thankful or grateful for your input. It is always great to have people making contributions and being helpful around here. _________________ "The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep." - Robert Frost
"I am one of the noticeable ones - notice me" - Dale Frances McKenzie Bozzio
Sure thing! Typically I'll read through a bunch of threads on topics like this in forums like this and try to figure something out and then when I do, try to leave a comment about what I did.
I'll do this both as a reference for other people who might be trying this same or a similar task but also for myself in the event that I need to be reminded.
As far as why I mention Entware and OTRW and it's because this script was provided on OTRW but doesn't seem to be available or included in/as an Entware package. So while "ancient" and "deprecated" OTRW seems to have scripts which Entware packages don't (to be expected), but are still useful (namely this one).
As far as spreading misinformation about using binary backups to copy settings to an upgraded router my understanding that it's a bad idea comes from this page (https://wiki.dd-wrt.com/wiki/index.php/Installation) where it says:
"Upgrading to a Newer Version of DD-WRT
If DD-WRT is already installed on your router, you can simply upgrade to a new version via the web interface or TFTP. However, it is highly recommended that you restore the router to defaults using the reset button before and after flash. Never restore old backups from previous versions! Skipping these steps could lead to a bricked device!"
Hopefully that addresses your comment, "Same router model to same router model is benign, unless you can infallibly prove otherwise instead of using speculation and conjecture that may result in misinformation."
If misinformation is contained in the Installation instructions that's not an ideal situation. Or perhaps I'm misunderstanding what you meant?
Sorry, my misinformation rhetoric was not directed at you, jdwh2. The information in the wiki regarding using older version backups applies to nvram variable changes and other gremlins, specifically. At some point, nvram backups now have a firmware version number in the filename. I have not seen any hard evidence that the firmware version number addition prevents using the backup on a different version of DD-WRT myself, but if someone can provide absolute proof, that would be quite welcomed. _________________ "The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep." - Robert Frost
"I am one of the noticeable ones - notice me" - Dale Frances McKenzie Bozzio