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.

[ad#ad-post-1]

 

#!/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.

[ad#post-image]