Taking cisco router Config-file backup from Linux machine using private and public rsa-ssh-key for password less authentication .
!!! This is live tested example !!!
root@test# ssh-keygen -t rsa
root@test# it will ask to you for rsa ssh key name and where to save this rsa ssh key the give the destination path,
if you want to save at specific location or if you press enter then it will save at root home directory bydefualt.
root@test# give how many bit to be create ssh key i.e. 2048
Creating ssh key ok….
Now rsa 2048 key has been created.
root@test# more rsa_sshtest.pub
root@test# then copy that all ssh key into notepad.
Log into cisco router which is you want to take backup of config file for every day.
And run the following commands on the router.
Telnet or ssh login 188.8.131.52 ( type username and password)
Type enable password.
R1# conf t
R1(config)#aaa authentication login MVPN local
R1(config)#aaa authorization exec default local
R1(config)#aaa authorization network MVPN local
R1(config)#username backup pri 15 sec ( passowrd)
R1(config)#ip ssh pubkey-chain
R1(config)#(user-data)# past the rsa ssh pub key which is generated
on linux machine.
R1(config)#exit > enter
To take backup of any cisco device please run Commands on linux machines.
Command to be executing on the machine as below.
Commands :- scp - i /home/backup/rsa_testkey email@example.com:nvram:startup-config
Please use rsa 2048 bit ssh key for more security.
The administrator has disabled public write access.
Re: Autobackup of Router Config file using SSH key
3 years 6 months ago #38395
Can recommend setting up Rancid from www.shrubbery.net/rancid/ with postfix and cvs.
Automatically keeps versioncontrol and backup + emails you/your Group if any changes are made to the config.
I set mine up with cvsweb as frontend for easy versionbrowsing. See Attached.