IOS Tips and Tricks, Part 7

With the current IOS you can archive the running config. To create an archive, enter archive configuration mode and specify the target for the archived files. For example, if you’d like to place the archive on a TFTP server at 192.168.0.2 using the filename Alex, you would do this:

Router(config)#archive
Router(config-archive)#path tftp://192.168.0.2/Alex

This adds an archive section to the running config:

Router#show run | section archive
archive
path tftp://192.168.0.2/Alex

Once the archive path has been configured, you can manually trigger archive sends from privileged mode:

Router#archive config

The archive entries will be assigned increasing revision numbers as they are created. If the filename specified was Alex, the individual archive entries will have the names Alex-1, Alex-2, etc. You can view the archive history using show archive:

Router#show archive

The next archive file will be named tftp://192.168.0.2/Alex-5

Archive #  Name
0
1       tftp://192.168.0.2/Alex-1
2       tftp://192.168.0.2/Alex-2
3       tftp://192.168.0.2/Alex-3
4       tftp://192.168.0.2/Alex-4 <- Most Recent
Router#

You can configure the device to do an automatic archive send whenever the running config is saved to NVRAM by using the write-memory option:

Router(config)#archive
Router(config-archive)#path tftp://192.168.0.2/Alex
Router(config-archive)#write-memory

You can also configure the device to archive the running config at periodic intervals. For example, to archive the running config every hour (which is most likely overkill), you would do this:

Router#conf t
Router(config)#archive
Router(config-archive)#path tftp://192.168.0.2/Alex
Router(config-archive)#time-period 60

If desired, you can combine the various triggering modes. Now that we have some configs archived, we can use them to roll back the running config. For example, to roll back to the archive file “Alex-3” that’s residing on the TFTP at 192.168.0.2, we would do this:

Alex#configure replace tftp://192.168.0.2/Alex-3

We can also tell the device to log all changes made to the running config, like this:

Router(config)#archive
Router(config-archive)#log config
Router(config-archive-log-cfg)#logging enable

Now, let’s make some changes to the running config:

Router#conf t
Router(config)#int loop 99
Router(config-if)#ip addr 10.1.1.1 255.255.255.255
Router(config-if)#end

To view the logging buffer and see the changes, use “show archive log config all” from privileged mode:

Router#show archive log config all
idx   sess           user@line      Logged command
1     1        console@console  |  logging enable
2     2        console@console  |interface loop 99
3     2        console@console  | ip address 10.1.1.1 255.255.255.255
Router#

In this article

Join the Conversation

3 comments

  1. Josh Reply

    Something of interest. The path command will take host and time variables. So your example of
    Router(config-archive)#path tftp://192.168.0.2/$h-$t.cfg
    will produce a file Router-Jan-14-07-50-49.cfg-0
    You also have several file transfer options with the path including ftp.

  2. sebastien Reply

    Let’s say i set the maximum number of archive to 5 , what’s going to happen when i will perform a new backup.
    Will the first backup tftp://192.168.0.2/Alex-1 be overwrited ?

    Seb

  3. Al Friebe Reply

    Sorry for the delay, been busy!

    Josh: When I tried using the date and time variables, the Solar Winds TFTP server gave an error due to “bad characters in the path”.

    Sebastian: If your device is equipped with “Disk0” or some such file system (a flash memory ATA disk), that’s what happens. If you are writing to a network device (such as a TFTP server), if you try to set a maximum you get the message “Cannot set maximum when backing up to network path”.