Simple Scenarios
Articles » Identify Changes in Router Configurations » Simple Scenarios
On the surface, the Contextual Configuration Diff looks like a great idea – you give it two configuration files (they have to be complete and in the format generated by the show running-config command) and the show archive config differences start-configuration target-configuration displays the IOS configuration commands (both removals and additions) needed to change the first file into the second one. You can compare any two configuration files; most commonly, you would compare the running configuration with the startup one with the show archive config differences nvram:startup-config system:running-config command, but you could also compare configurations stored in flash memory or on a remote server accessible via a variety of protocols (FTP, HTTP, SSL, RCP, SCP, and TFTP):
fw#copy system:running-config tftp://10.0.0.2/fw-test
!!
2009 bytes copied in 0.592 secs (3394 bytes/sec)
fw#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
fw(config)#no access-list 100
fw(config)#access-list 120 permit ip any any
fw(config)#^Z
fw#show archive config differences tftp://10.0.0.2/fw-test system:running-config
Loading fw-test from 10.0.0.2 (via FastEthernet0/0): !
[OK - 2087 bytes]
Contextual Config Diffs:
+access-list 120 permit ip any any
-access-list 100 permit tcp any any eq www
-access-list 100 permit tcp any any eq telnet
- If you specify just one configuration file parameter, Cisco IOS assumes that the parameter is the target configuration and displays the differences between the running-config and the target configuration (the opposite of what I would expect).
- The show archive config differences command will not accept startup-config or running-config as filenames but requires full file path (nvram:startup-config and system:running-config).
Warm-up Tests
I started testing this feature with a few simple test cases. As expected, IOS generated correct differences in all of them:
interface Loopback0
ip address 10.1.0.1 255.255.255.255
interface Loopback0
description New loopback interface
ip address 10.1.0.3 255.255.255.255
config
Contextual Config Diffs:
interface Loopback0
+description New loopback interface
+ip address 10.1.0.3 255.255.255.255
interface Loopback0
-ip address 10.1.0.1 255.255.255.255
Even more interesting, when you remove a complete configuration section, the router lists all previously configured commands in the differences, making it very easy to identify exactly which settings disappeared together with a major configuration object. For example, when I removed the OSPF process with the no router ospf 101 command, Cisco IOS reported these changes:
fw#show archive config differences nvram:startup-config system:running-config
Contextual Config Diffs:
-router ospf 101
-log-adjacency-changes
-network 10.1.0.0 0.0.1.255 area 2
-network 0.0.0.0 255.255.255.255 area 0