Technical Documentation

Comparing Configuration Changes with a Prior Version

In configuration mode only, when you have made changes to the configuration and want to compare the candidate configuration with a prior version, you can use the compare command to display the configuration. The compare command compares the candidate configuration with either the current committed configuration or a configuration file and displays the differences between the two configurations. To compare configurations, specify the compare command after the pipe:

[edit]user@host# show | compare (filename | rollback n)

filename is the full path to a configuration file. The file must be in the proper format: a hierarchy of statements.

n is the index into the list of previously committed configurations. The most recently saved configuration is number 0, and the oldest saved configuration is number 49. If you do not specify arguments, the candidate configuration is compared against the active configuration file (/config/juniper.conf).

The comparison output uses the following conventions:

  • Statements that are only in the candidate configuration are prefixed with a plus sign (+).
  • Statements that are only in the comparison file are prefixed with a minus sign (–).
  • Statements that are unchanged are prefixed with a single blank space ( ).

The following example shows various changes, then a comparison of the candidate configuration with the active configuration, showing only the changes made at the [edit protocols bgp] hierarchy level:

[edit]user@host# edit protocols bgp [edit protocols bgp]user@host# show group my-group {type internal;hold-time 60;advertise-inactive;allow;}group fred {type external;peer-as 33333;allow;}group test-peers {type external;allow;}[edit protocols bgp]user@host# set group my-group hold-time 90 [edit protocols bgp]user@host# delete group my-group advertise-inactive [edit protocols bgp]user@host# set group fred advertise-inactive [edit protocols bgp]user@host# delete group test-peers [edit protocols bgp]user@host# show | compare [edit protocols bgp group my-group]-hold-time 60;+hold-time 90;-advertise-inactive;[edit protocols bgp group fred]+advertise-inactive;[edit protocols bgp]-group test-peers {-type external;-allow;}[edit protocols bgp]user@host# show group my-group {type internal;hold-time 90;allow;}group fred {type external;advertise-inactive;peer-as 3333;allow;}

Published: 2010-01-17