In our day to day work as network administrators it is often necessary to compare configuration files of Cisco routers, switches, firewalls etc.
As we know, a characteristic of Cisco IOS is that the configuration files are stored in text format, but still a line by line comparison of different config files is tedious and in many cases almost impossible.
Imagine a situation whereby you have stored several different router configurations somewhere and you want to compare the differences.
Or maybe your support vendor or technician has made recently some configuration changes on your main ASA firewall device and you want to check what they changed compared to previous configs.
For these reasons it would be useful to present some methods and tools that allow us to perform such config comparison tasks with full automation.
Configuration Files Comparison Tools
One option to help us compare Cisco configuration files is to export the config files in text format and then use a software tool to perform line by line comparison for us between different files.
The easiest way to export a configuration file in text format is to execute the command “show run” or “show startup“, press the “space bar” key several times until the end of the configuration and then copy and paste the lines from the Terminal screen to a text editor.
Then you can import this text configuration file into a specialized comparison tool such as the ones below:
A free program available on the Internet to compare text files is Compare It 4. It can be downloaded from the official site: http://www.grigsoft.com/wincmp3.htm
For text files, it will present the two configuration texts side-by-side with differences shown in colors and sections for easy visualization.
This tool can also compare binary files, image files, PDF, word, excel etc.
Solarwinds is a well know vendor of networking and IT management software.
The Config Compare Tool is part of the SolarWinds Engineer’s Toolset which is a package of several useful tools for networking and IT.
The tool runs directly on the target device and compares the currently running configuration with the stored “startup configuration”.
You will need to enter the device (router, switch etc) IP and login credentials so the tool can connect and compare the two configs (running and startup).
This is an online tool so no installation is needed. It can compare two Cisco configurations. You can copy and paste the configurations in two windows and just click “compare”
This is another open source free and popular tool which does comparison and merging.
It even comes in portable version so you don’t even have to install anything.
It provides the classical side-by-side comparison windows showing the two text files and the highlighted changes and differences. It can even compare folders of several files.
This is another useful comparison tool that works on Windows, MAC OS X and Linux. It is a paid tool but very cheap ($19).
It can find differences in multiple files, merge files and also find differences in folders.
Comparing using Cisco IOS Commands
From IOS version 12.3 (4)T and later, the comparison can be made directly on the IOS command line.
The commands to compare the running configuration from the startup configuration are the following:
Router # show archive config differences system: running-config nvram: startup-config
Contextual Config Diffs:
+ ip dhcp excluded-address 172.16.1.106 172.16.1.254
– ip dhcp excluded-address 172.16.1.160 172.16.1.254
To understand the output above, you need to know the following:
- The plus symbol (+) means that the configuration line exists in the “startup-config” but not in the “running-config”
- The minus symbol (-) means that the configuration line exists in “running-config” but not in “startup-config”.
In our example above, there is a command in backup configuration file (startup-config) that excludes address range 172.16.1.106 up to 172.16.1.254 from the DHCP address pool.
The comparison shows that someone has entered and changed the range of excluded addresses, and replaced it by range 172.16.1.160 to 172.16.1.254 and did not save the changes.
That’s why the changes are only present in the active configuration (running-config). The command which is present in the running-config is preceded by the minus (-) symbol.
In our example above, the only difference between the two files are the two excluded-address commands.
If there were more differences they would be listed as well. The command only displays the lines of the files in which there are differences. The order of the path is important as we’ll see below.
Router # show archive config differences flash:STARTUP-CONFIG system:running-config
Contextual Config Diffs:
+router eigrp 100
-router ospf 1
-network 220.127.116.11 0.0.0.0 area 0
A “+” sign means this command is present in the “running-config” but not in the “STARTUP-CONFIG”
A “-” sign means this command is present in the “STARTUP-CONFIG” but not in the “running-config”
I hope the post was helpful. If you have any more information or you want to provide additional references on the file comparison feature feel free to comment below.
- How to Configure SNMP on Cisco Devices (Routers, Switches)
- Cisco Access List Configuration Examples (Standard, Extended ACL) on Routers Etc
- PPTP Remote Access VPN Configuration on Cisco Routers
- Cisco IOS Zone Based Firewall Configuration Example (ZBF)
- How to Disable Telnet and Enable SSH on Cisco Devices