Backup and restore via ssh

Post new topic   Reply to topic    DD-WRT Forum Forum Index -> General Questions
Author Message
jauch888888
DD-WRT User


Joined: 23 Apr 2020
Posts: 129

PostPosted: Fri Apr 24, 2020 0:24    Post subject: Backup and restore via ssh Reply with quote
Hi,

I've read that we can update build with ssh but I wonder if we can do the same to backup the build image and to restoring.
?

Thanks
Sponsor
mrjcd
DD-WRT Guru


Joined: 31 Jan 2015
Posts: 5385
Location: Texas

PostPosted: Fri Apr 24, 2020 2:16    Post subject: Reply with quote
for nvram backup 'bout same thing you can do from the webif

nvram backup

nvram restore
reboot

simple if you have a USB drive to send it to so you can easily get it to save or whatever.

you can just send to /tmp but then you gotta get it or lose it after a reboot Razz

since I have a flash drive on this EA8500 mounted to /tmp/mnt/sda I just name it 'backupdate.bin' like so ---
nvram backup /tmp/mnt/sda/backup042320.bin
AFAIK you can name it whatever
since this is just a switch with a VLAN on 2 ports + an OVPN server I can play with it a bit so we'll see
if ssh nvram backup & restore still works

example: 'guess it still works good for me' Twisted Evil
jauch888888
DD-WRT User


Joined: 23 Apr 2020
Posts: 129

PostPosted: Fri Apr 24, 2020 2:51    Post subject: Reply with quote
mrjcd wrote:
for nvram backup 'bout same thing you can do from the webif

nvram backup

nvram restore
reboot

simple if you have a USB drive to send it to so you can easily get it to save or whatever.

you can just send to /tmp but then you gotta get it or lose it after a reboot Razz

since I have a flash drive on this EA8500 mounted to /tmp/mnt/sda I just name it 'backupdate.bin' like so ---
nvram backup /tmp/mnt/sda/backup042320.bin
AFAIK you can name it whatever
since this is just a switch with a VLAN on 2 ports + an OVPN server I can play with it a bit so we'll see
if ssh nvram backup & restore still works

example: 'guess it still works good for me' Twisted Evil



Thanks for the explanations.
I understand nvram backup but to do the restore I need to install the backup somewhere before? If I dont use usb, the backup needs to be in tmp?
mrjcd
DD-WRT Guru


Joined: 31 Jan 2015
Posts: 5385
Location: Texas

PostPosted: Fri Apr 24, 2020 2:57    Post subject: Reply with quote
jauch888888 wrote:
If I dont use usb, the backup needs to be in tmp?

yeahuh that would probably the best place for it
or
maybe a JFFS directory

simple way is just use the webif Laughing
mrjcd
DD-WRT Guru


Joined: 31 Jan 2015
Posts: 5385
Location: Texas

PostPosted: Fri Apr 24, 2020 14:54    Post subject: Reply with quote
AND
here is a 6 year old post that tells ya 'bout same thing as I did ---

https://forum.dd-wrt.com/phpBB2/viewtopic.php?p=907719
jauch888888
DD-WRT User


Joined: 23 Apr 2020
Posts: 129

PostPosted: Fri Apr 24, 2020 15:35    Post subject: Reply with quote
mrjcd wrote:
AND
here is a 6 year old post that tells ya 'bout same thing as I did ---

https://forum.dd-wrt.com/phpBB2/viewtopic.php?p=907719


Thanks.

The wget command line is still valid, I mean the ip address?

Exemple, that, should be good?

"wget http://192.168.250.254/nvrambak.bin --root -- xxxxxxx.

Thanks
mrjcd
DD-WRT Guru


Joined: 31 Jan 2015
Posts: 5385
Location: Texas

PostPosted: Fri Apr 24, 2020 16:06    Post subject: Reply with quote
jauch888888 wrote:
The wget command line is still valid, I mean the ip address?

Yes, that still works just fine. I just done it from this Debian machine and it saved the 'nvrambak.bin'
in my 'Home' directory. I then used the GUI (webif) to restore and all is good.

of course you have to use correct router IP, username & password ...below is all correct for this EA8500 ---
---reckon I should change its PW now but no worries cause that is the only PW and only unit I used it on
and besides it is within my local net


Code:
mrjcd@daDeb:~$  wget http://10.72.28.52/nvrambak.bin --user mrjcd --password bcGfREXeNQarGQ3AuJ8UdFyQ
--2020-04-24 10:53:03--  http://10.72.28.52/nvrambak.bin
Connecting to 10.72.28.52:80... connected.
HTTP request sent, awaiting response... 401 Unauthorized
Authentication selected: Basic realm="EA8500"
Connecting to 10.72.28.52:80... connected.
HTTP request sent, awaiting response... 200 Ok
Length: 36923 (36K) [application/octet-stream]
Saving to: ‘nvrambak.bin’

nvrambak.bin                     100%[========================================================>]  36.06K  --.-KB/s    in 0.009s 

2020-04-24 10:53:03 (3.86 MB/s) - ‘nvrambak.bin’ saved [36923/36923]

mrjcd@daDeb:~$ date
Fri 24 Apr 2020 10:53:50 AM CDT
mrjcd@daDeb:
Razz Twisted Evil Cool
jauch888888
DD-WRT User


Joined: 23 Apr 2020
Posts: 129

PostPosted: Fri Apr 24, 2020 16:21    Post subject: Reply with quote
does not work for me....

root@DD-WRT:~# wget http://192.168.11.1/nvrambak.bin -- user root -- password 6eV...........$$##
Connecting to 192.168.11.1 (192.168.11.1:80)
wget: server returned error: HTTP/1.1 401 Unauthorized
mrjcd
DD-WRT Guru


Joined: 31 Jan 2015
Posts: 5385
Location: Texas

PostPosted: Fri Apr 24, 2020 17:04    Post subject: Reply with quote
well it worky ok for me ...but then again, I am using a real Linux machine Cool
my OS is naming them ‘nvrambak.bin’, ‘nvrambak.bin.1’, ‘nvrambak.bin.2’ just cause they are all piling in same directory

first one from WNDR3700v4 DD-WRT r42954

2. from broadcom ASUS RT-N12D1 DD-WRT r42925

3. from a pissy 4MB flash WNR2000v3 DD-WRT r42708

and yea the PW has been xxxx out Razz
::::::::::::::::::::::::::::::::::::::
Code:
mrjcd@daDeb:~$ wget http://10.72.28.51/nvrambak.bin --user mrjcd --password xxxxxxxxxxxxxxxxxxxx
--2020-04-24 11:45:36--  http://10.72.28.51/nvrambak.bin
Connecting to 10.72.28.51:80... connected.
HTTP request sent, awaiting response... 401 Unauthorized
Authentication selected: Basic realm="Citadel-Switch"
Connecting to 10.72.28.51:80... connected.
HTTP request sent, awaiting response... 200 Ok
Length: 41276 (40K) [application/octet-stream]
Saving to: ‘nvrambak.bin’

nvrambak.bin                     100%[========================================================>]  40.31K  --.-KB/s    in 0.003s 

2020-04-24 11:45:37 (15.3 MB/s) - ‘nvrambak.bin’ saved [41276/41276]

mrjcd@daDeb:~$ wget http://10.72.28.55/nvrambak.bin --user jcd --password xxxxxxxxx
--2020-04-24 11:45:56--  http://10.72.28.55/nvrambak.bin
Connecting to 10.72.28.55:80... connected.
HTTP request sent, awaiting response... 401 Unauthorized
Authentication selected: Basic realm="VolusRTN12D1"
Connecting to 10.72.28.55:80... connected.
HTTP request sent, awaiting response... 200 Ok
Length: 29619 (29K) [application/octet-stream]
Saving to: ‘nvrambak.bin.1’

nvrambak.bin.1                   100%[========================================================>]  28.92K  --.-KB/s    in 0.01s   

2020-04-24 11:45:56 (2.72 MB/s) - ‘nvrambak.bin.1’ saved [29619/29619]

mrjcd@daDeb:~$ date
Fri 24 Apr 2020 11:46:09 AM CDT
mrjcd@daDeb:~$ wget http://10.72.28.60/nvrambak.bin --user jcd --password xxxxxxxxx
--2020-04-24 11:47:59--  http://10.72.28.60/nvrambak.bin
Connecting to 10.72.28.60:80... connected.
HTTP request sent, awaiting response... 401 Unauthorized
Authentication selected: Basic realm="Grammy-WNR2000v3"
Connecting to 10.72.28.60:80... connected.
HTTP request sent, awaiting response... 200 Ok
Length: 23772 (23K) [application/octet-stream]
Saving to: ‘nvrambak.bin.2’

nvrambak.bin.2                   100%[========================================================>]  23.21K  --.-KB/s    in 0.006s 

2020-04-24 11:47:59 (3.94 MB/s) - ‘nvrambak.bin.2’ saved [23772/23772]

mrjcd@daDeb:~$ date
Fri 24 Apr 2020 11:48:05 AM CDT
mrjcd@daDeb:~$
jauch888888
DD-WRT User


Joined: 23 Apr 2020
Posts: 129

PostPosted: Fri Apr 24, 2020 17:13    Post subject: Reply with quote
Ok maybe cause on my router the backup is not nvram.bin but nvram.netgear.r7800.bin etc...
mrjcd
DD-WRT Guru


Joined: 31 Jan 2015
Posts: 5385
Location: Texas

PostPosted: Fri Apr 24, 2020 17:28    Post subject: Reply with quote
GUI backup was changed a bit a while back ---
If you do backup from the webif it will be named:
nvrambak_DD-WRT version_routername_routermodel.bin

and yea, a restore now days will check router board just so you cannot put a backup from one router to a different router model.

Here is same units with webif backup done:

nvrambak_r42954_Citadel-Switch_Netgear WNDR3700 V4.bin

nvrambak_r42925_VolusRTN12D1_Asus RT-N12B.bin

nvrambak_r42708_Grammy-WNR2000v3_Netgear WNR2000v3.bin

nvrambak_r42967_EA8500_Linksys EA8500.bin ...same one I done SSH backup yesterday

nvrambak_r42967_Citadel-Station-Homeworld_Linksys EA8500.bin ... my main gateway router


---
EDIT:
the Asus RT-N12B is really an Asus RT-N12D1 I promise.
that just the way it is and you will also know that if you have one and/or been around here long as me Twisted Evil
jauch888888
DD-WRT User


Joined: 23 Apr 2020
Posts: 129

PostPosted: Fri Apr 24, 2020 18:37    Post subject: Reply with quote
Ok, so,to be sure, please could you give me your code you've done with your Linksys EA8500 via ssh yesteday.
Thanks.

I use putty via windows btw
mrjcd
DD-WRT Guru


Joined: 31 Jan 2015
Posts: 5385
Location: Texas

PostPosted: Fri Apr 24, 2020 18:43    Post subject: Reply with quote
jauch888888 wrote:
I use putty via windows btw

hmmm ok, let me swivel the chair around and see what the ol WIN10 Putty will do ... give me few minutes Twisted Evil

:::::::::::::::::

if you use PuTTy do the 'nvram backup' ...looky like that works fine.
Since you don't have a USB you should put in the /tmp directory
Prolly have to use sompin like winscp to get it but I ain't gonna tell ya nothin about that... Better let winders users tell ya.
Code:
Using username "root".
Pre-authentication banner message from server:
| DD-WRT v3.0-r42967 std (c) 2020 NewMedia-NET GmbH
| Release: 04/21/20
| Board: Linksys EA8500
End of banner message from server
Authenticating with public key "mrjcd@mrjcd.com"
==========================================================
 
     ___  ___     _      _____  ______       ____  ___
    / _ \/ _ \___| | /| / / _ \/_  __/ _  __|_  / / _ \
   / // / // /___/ |/ |/ / , _/ / /   | |/ //_ <_/ // /
  /____/____/    |__/|__/_/|_| /_/    |___/____(_)___/
                                                     
                       DD-WRT v3.0
                   http://www.dd-wrt.com
 
==========================================================


BusyBox v1.31.1 (2020-04-21 01:29:11 +03) built-in shell (ash)

root@EA8500:~#
root@EA8500:~# cd /tmp/
root@EA8500:/tmp# ls
TZ                board1.bin        dnsmasq.conf      loginprompt       openvpn           root              www
ath0_configured   board2.bin        eap_identities    mnt               openvpnserver     services
ath10k-board.bin  cron.d            etc               nvram             openvpnsrv_fw.sh  smb.conf
ath1_configured   disk              hosts             nvstate           resolv.conf       smb.db
blocklist         disktype.dump     ksmbd.lock        oet               resolv.dnsmasq    var
root@EA8500:/tmp# cd
root@EA8500:~# nvram backup /tmp/backup042420.bin
root@EA8500:~# cd /tmp/
root@EA8500:/tmp# ls
TZ                blocklist         disktype.dump     ksmbd.lock        oet               resolv.dnsmasq    var
ath0_configured   board1.bin        dnsmasq.conf      loginprompt       openvpn           root              www
ath10k-board.bin  board2.bin        eap_identities    mnt               openvpnserver     services
ath1_configured   cron.d            etc               nvram             openvpnsrv_fw.sh  smb.conf
backup042420.bin  disk              hosts             nvstate           resolv.conf       smb.db
root@EA8500:/tmp# exit

OR
I reckon you could enable JFFS2 and make it availible thru samba share and just grab it that way but that
seems like alot of mess to me.
Is there some reason you cannot use the webif since that is what it is made for Rolling Eyes
SurprisedItWorks
DD-WRT Guru


Joined: 04 Aug 2018
Posts: 1062
Location: Appalachian mountains, USA

PostPosted: Sat Apr 25, 2020 21:47    Post subject: Reply with quote
mrjcd wrote:
Is there some reason you cannot use the webif since that is what it is made for Rolling Eyes

Scripting. I have long had the backup process automated so that in the bash window I keep open on my laptop, I type bu 12 and the script backs up into my laptop's current working directory the dd-wrt config and the output of nvram show into files with .12 appended as a version number corresponding to notes I keep on each version. The script uses ssh and scp. Optional arguments let me use multiple layers of encryption to back up or restore any of a handful of routers in my care that live far away, across the internet, and that are set up to permit extremely tightened-down (securitywise) maintenance connections.

So the question feels a bit like asking why one can't just use Windows and do everything one click at a time? Why fool with that gosh-darned (!) linux thingy? Why write the math-laden paper with latex? Why can't you use WORD like everyone else? Why drive an MX-5 Miata? (I don't, but it's an example.) Why eat chocolate? (I do.) Why fuss with dd-wrt? Isn't the stock Netgear firmware good enough?

Oh wait...

_________________
Five WRT1900ACSv2's on 42926, 44048.
VLANs, VAPs, NAS, client-mode travel router, OpenVPN client (AirVPN), DDNS, wireguard servers, wireguard clients (AzireVPN), two DNSCrypt DNS providers (incl Quad9) via OpenVPN/wireguard clients.
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Forum Index -> General Questions All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum