How to backup running config on Cisco switch&router.

This is a simple solution for backup running config on Cisco switch&router. Before you start to backup you should install

  1. tftp service
  2. expect command

After installed tfpt service & expect command. You can test to backup script by my example script below.

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/expect
 
 
set username "USERNAME"
set password "PASSWORD"
 
spawn telnet IP-Core-SWITCH
 
 
# -- Authenticate -- #
expect "Username: ";
send "$username\r";
expect "Password: ";
send "$password\r";
 
 
# -- Copy file to TFTP Server -- #
expect "*#";
send "copy flash:config.text tftp://IP-Backup-Server/config.text\r";
expect "*\?";
send "\r";
 
expect "*\?";
send "\r";
 
expect "*#";
send "exit\r";
 
interact

After you create a script complete, you should change a permission of this script to 700.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

*

*


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">