Friday, June 27, 2008

Cisco Commands - Show difference between running config and startup config

Ever wonder exactly what changes have been made to the running config? Should you save them before reloading or would that break everything. Use show archive config differences nvram:startup-config system:running-config to view the difference between the startup config and the current running config.

show archive config differences nvram:startup-config system:running-config

router#show archive config differences nvram:startup-config system:running-config
Contextual Config Diffs:
+ip access-list extended test

120651-149720#

More Info:
http://www.2000trainers.com/cisco-ccna-07/ccna-router-configuration-files/
http://www.cisco.com/en/US/docs/ios/12_3t/12_3t4/feature/guide/gt_diff.html
http://www.cisco.com/en/US/docs/ios/12_3t/12_3t4/feature/guide/gt_diff.html#wp1068464

Cisco Commands - Archive and Archive Config

Automated backups/revisions of configs on Cisco routers.

http://www.cisco.com/en/US/docs/ios/12_3t/fun/command/reference/cfrgt_01.html#wp1094316

archive

To enter archive configuration mode, use the archive command in global configuration mode.

archive

Syntax Description

This command has no arguments or keywords.

Defaults

No default behavior or values

Command Modes

Global configuration

Command History


Release
Modification

12.3(4)T

This command was introduced.

12.2(25)S

This command was integrated into Cisco IOS Release 12.2(25)S.


Examples

The following example shows how to place the router in archive configuration mode:

Router(config)# archive
Router(config-archive)# path disk0:myconfig

Related Commands


Command
Description

log config

Enters configuration change logger configuration mode.

logging enable

Enables the logging of configuration changes.

maximum

Sets the maximum number of archive files of the running configuration to be saved in the Cisco IOS configuration archive.

path

Specifies the location and filename prefix for the files in the Cisco IOS configuration archive.

time-period

Sets the time increment for automatically saving an archive file of the current running configuration in the Cisco IOS configuration archive.


archive config

To save a copy of the current running configuration to the Cisco IOS configuration archive, use the archive config command in privileged EXEC mode.

archive config

Syntax Description

This command has no arguments or keywords.

Command Modes

Privileged EXEC

Command History


Release
Modification

12.3(7)T

This command was introduced.

12.2(25)S

This command was integrated into Cisco IOS Release 12.2(25)S.


Usage Guidelines


Note Before using this command, you must configure the path command in order to specify the location and filename prefix for the files in the Cisco IOS configuration archive.


The Cisco IOS configuration archive is intended to provide a mechanism to store, organize, and manage an archive of Cisco IOS configuration files in order to enhance the configuration rollback capability provided by the configure replace command. Before this feature was introduced, you could save copies of the running configuration using the copy running-config destination-url command, storing the target file either locally or remotely. However, this method lacked any automated file management. On the other hand, the Configuration Replace and Configuration Rollback feature provides the capability to automatically save copies of the running configuration to the Cisco IOS configuration archive. These archived files serve as checkpoint configuration references and can be used by the configure replace command to revert to previous configuration states.

The archive config command allows you to save Cisco IOS configurations in the configuration archive using a standard location and filename prefix that is automatically appended with an incremental version number (and optional timestamp) as each consecutive file is saved. This functionality provides a means for consistent identification of saved Cisco IOS configuration files. You can specify how many versions of the running configuration will be kept in the archive. After the maximum number of files has been saved in the archive, the oldest file will be automatically deleted when the next, most recent file is saved. The show archive command displays information for all configuration files saved in the Cisco IOS configuration archive.

Examples

The following example shows how to save the current running configuration to the Cisco IOS configuration archive using the archive config command. Before using the archive config command, you must configure the path command in order to specify the location and filename prefix for the files in the Cisco IOS configuration archive. In this example, the location and filename prefix is specified as disk0:myconfig as follows:

Router# configure terminal
Router(config)# archive
Router(config-archive)# path disk0:myconfig

You then save the current running configuration in the configuration archive as follows:

Router# archive config

The show archive command displays information on the files saved in the configuration archive as shown in the following sample output:

Router# show archive

There are currently 1 archive configurations saved.
The next archive file will be named disk0:myconfig-2
 Archive #  Name
   0
   1       disk0:myconfig-1 <- Most Recent
   2
   3
   4
   5
   6
   7
   8
   9
   10

Related Commands


Command
Description

archive

Enters archive configuration mode.

configure confirm

Confirms replacement of the current running configuration with a saved Cisco IOS configuration file.

configure replace

Replaces the current running configuration with a saved Cisco IOS configuration file.

maximum

Sets the maximum number of archive files of the running configuration to be saved in the Cisco IOS configuration archive.

path

Specifies the location and filename prefix for the files in the Cisco IOS configuration archive.

show archive

Displays information about the files saved in the Cisco IOS configuration archive.

time-period

Sets the time increment for automatically saving an archive file of the current running configuration in the Cisco IOS configuration archive.

Cisco Commands - config replace

Config replace allows you to overwrite your running config with the startup config or a config from flash, tftp, etc. WITHOUT reloading the router.

More info:
http://articles.techrepublic.com.com/5100-10878_11-6184709.html

http://www.cisco.com/en/US/docs/ios/12_3t/12_3t7/feature/guide/gtrollbk.html

Configuration Replace

The configure replace command provides the capability to replace the current running configuration with any saved Cisco IOS configuration file. This functionality can be used to revert to a previous configuration state, effectively rolling back any configuration changes that were made since the previous configuration state was saved.

When using the configure replace command, you must specify a saved Cisco IOS configuration as the replacement configuration file for the current running configuration. The replacement file must be a complete configuration generated by a Cisco IOS device (for example, a configuration generated by the copy running-config destination-url command), or, if generated externally, the replacement file must comply with the format of files generated by Cisco IOS devices. When the configure replace command is entered, the current running configuration is compared with the specified replacement configuration and a set of diffs is generated. The algorithm used to compare the two files is the same as that employed by the show archive config differences command. The resulting diffs are then applied by the Cisco IOS parser to achieve the replacement configuration state. Only the diffs are applied, avoiding potential service disruption from reapplying configuration commands that already exist in the current running configuration. This algorithm effectively handles configuration changes to order-dependent commands (such as access lists) through a multiple pass process. Under normal circumstances, no more than three passes are needed to complete a configuration replace operation, and a limit of five passes is performed to preclude any looping behavior.

The Cisco IOS copy source-url running-config command is often used to copy a stored Cisco IOS configuration file to the running configuration. When using the copy source-url running-config command as an alternative to the configure replace target-url command, the following major differences should be noted:

The copy source-url running-config command is a merge operation and preserves all the commands from both the source file and the current running configuration. This command does not remove commands from the current running configuration that are not present in the source file. In contrast, the configure replace target-url command removes commands from the current running configuration that are not present in the replacement file and adds commands to the current running configuration that need to be added.

The copy source-url running-config command applies every command in the source file, whether or not the command is already present in the current running configuration. This algorithm is inefficient and, in some cases, can result in service outages. In contrast, the configure replace target-url command only applies the commands that need to be applied—no existing commands in the current running configuration are reapplied.

A partial configuration file may be used as the source file for the copy source-url running-config command, whereas a complete Cisco IOS configuration file must be used as the replacement file for the configure replace target-url command.