Automatic router backup to FTP server – How to configure?

External servers are often used to store security backups of network devices like Cisco or Juniper switches and routers. This backups include operation system images like Cisco IOS and Juniper JUNOS, and more often configuration files from devices. Configuration files, when saved to remote server, are guarantee they we will easily restore all of our configuration on new device if the current device fail. We will be able to do this settings restore in a very small amount of time avoiding extended network outage that can be disastrous for our company business in peek times of the day. Depending on our device, we might be able to back up operating system and configuration information to a TFTP, FTP, HTTP, or SCP server. In this article we will set up an FTP backup that will send all of our configurations to the computer running FTP server application on it. If you intend to routinely copy backups to an FTP server, you can avoid specifying the login credentials each time (for security purposes), by adding those credentials to the router’s configuration. Furthermore, if you don’t want to manually make the backups across the time, we will show here how to make a configuration in witch the router will make automatic periodical backups to that FTP server. This is the most interesting part of this configuration because it will save you time and problems with remembering to do the backups by yourself. Let’s dive into configuration.

Cisco config

Adding FTP Server Login Credentials to a Router’s Configuration:

R1# conf term
R1(config)# ip ftp username myusername
R1(config)# ip ftp password myenteredpassword
R1(config)# end

Backing Up a Router’s Startup Configuration to an FTP Server Without
Specifying Login Credentials:

R1# copy startup-config
Address or name of remote host []?
Destination filename [r1-confg]?
Writing r1-confg !
1446 bytes copied in 3.389 secs (427 bytes/sec)

Setting up automatic backup of a Router’s Startup Configuration to an FTP:
(“write-memory” command means that the backup will be initiated every time running-config is saved to startup-config)

R1(config-archive)#time-period 1440

You can restore a previously archived configuration using the configure replace command.
This command does not merge the archived configuration with the running configuration, but rather completely replaces the running configuration with the archived configuration. Example 1-8 shows the restoration of an archived configuration to a router.
Notice that the router’s hostname changes after the configuration restoration.

R1# configure replace
This will apply all necessary additions and deletions
to replace the current running configuration with the
contents of the specified configuration file, which is
assumed to be a complete configuration, not a partial
configuration. Enter Y if you are sure you want to proceed. ? [no]: Y
Loading R1-config-3 !
[OK - 3113/4096 bytes]

Juniper config

Backup Juniper device configuration file on FTP.

The following configuration sample shows how to backup the JUNOS configuration file on FTP server. On every commit applied on CLI, the EX switch will transfer a copy of the configuration file to an ASCII file on FTP server. The filename created on the FTP server contains hostname, date and time signature.

"ftp://username:[email protected]"; }}}

To backup the config file on time interval, you can also replace the ‘transfer-on-commit‘ statement with the statement ‘transfer-interval‘ with specifying interval in range of 15 to 2880 minutes.

To restore configuration file from FTP server The following configuration sample shows how to restore the JUNOS configuration from an ASCII configuration file that was previously stored on FTP server

 [edit] user@switch# edit system archival configuration
[edit system archival configuration]
 user@switch# load merge ftp://username:[email protected]/
 load complete
[edit system archival configuration]

The content on the ASCII file on the FTP server will be merged with the existing configuration on the switch. To replace the config file on the switch with the loaded file, use the ‘replace’ statement instead of ‘merge’.

One Response

  1. Alexandre Lima January 7, 2015

Leave a Reply