Wednesday, September 19, 2007

Compare Cisco Config use Diff

Sometimes I need to compare running-config and startup-config in Cisco router, may be there is command I configured but not sure to commit or save, or I have already miss configure and I lost some IOS command from running-config. As long as I know, IOS feature there is no feature use to rollback config from startup-config to current or running-config. But if there is IOS feature to rollback config from last startup-config, I think it is very risk to do it.

So I need something to compare running-config with startup-config, am I copy both of config and paste in text and use diff utility to compare it :-s ? I think this is traditional method.

I show to you about IOS Cisco feature configuration diff utility. I have little add command in new Cisco router and want to compare running-config and startup-config before write memory.

1#
R#show archive config differences system:running-config nvram:startup-config
Contextual Config Diffs:
+no service password-encryption
+no logging buffered
-service password-encryption
-logging buffered 4096 debugging
-no logging console
-enable secret 5 $1$I5HH$ljHLBZsJb9e3XGE.MRgUE.
line vty 0 4
-password 7 045802150C2E
-login

R#sh startup-config | i no
no service password-encryption
no logging buffered
no aaa new-model
no ip address
no ip address
no ip http secure-server

In contextual config diffs, there are + and -
+ indicates the configuration line exists in second text (startup-config) but not in first text (running config)
- indicates the configuration line exists in first text (running-config) but not in second text (startup-config)

or you can use : (the same result)
R#show archive config differences nvram:startup-config
Contextual Config Diffs:
+no service password-encryption
+no logging buffered
-service password-encryption
-logging buffered 4096 debugging
-no logging console
-enable secret 5 $1$I5HH$ljHLBZsJb9e3XGE.MRgUE.
line vty 0 4
-password 7 045802150C2E
-login

use command 'ignorecase' for ignore case sensitive text.
2#
R#sh archive config incremental-diffs nvram:startup-config ignorecase
!List of Commands:
no service password-encryption
no logging buffered
end

The list of commands there is not in running-config, same mean as dislpay line which will be added to running-config.

1 comment:

Subramani said...

There exist lot of tools to compare various configuration and doing a proper rollback. Let me know if you need any info

-Subbu