Supported Platforms
Related Documentation
- ACX, EX, J, M, MX, PTX, QFX, T Series
- Returning to the Most Recently Committed Junos Configuration
- Loading a Configuration from a File
- EX, M, MX, QFX, T Series
- Viewing Files and Directories on a Device Running Junos OS
Returning to a Previously Committed Junos OS Configuration
This topic explains how you can return to a configuration prior to the most recently committed one, and contains the following sections:
Returning to a Configuration Prior to the One Most Recently Committed
To return to a configuration prior to the most recently committed one, include the configuration number, 0 through 49, in the rollback command. The most recently saved configuration is number 0 (which is the default configuration to which the system returns), and the oldest saved configuration is number 49.
Displaying Previous Configurations
To display previous configurations, including the rollback number, date, time, the name of the user who committed changes, and the method of commit, use the rollback ? command.
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:
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:
Creating and Returning to a Rescue Configuration
A rescue configuration allows you to define a known working configuration or a configuration with a known state that you can roll back to at any time. This alleviates the necessity of having to remember the rollback number with the rollback command. You use the rescue configuration when you need to roll back to a known configuration or as a last resort if your router or switch configuration and the backup configuration files become damaged beyond repair.
To save the most recently committed configuration as the rescue configuration so that you can return to it at any time, issue the request system configuration rescue save command:
To return to the rescue configuration, use the rollback rescue configuration mode command:
![]() | Note: If the rescue configuration does not exist, or if the rescue configuration is not a complete, viable configuration, the rollback command fails, an error message appears, and the current configuration remains active. |
To activate the rescue configuration that you have loaded, use the commit command:
To delete an existing rescue configuration, issue the request system configuration rescue delete command:
For more information about the request system configuration rescue delete and request system configuration rescue save commands, see the Junos OS Operational Mode Commands.
Saving a Configuration to a File
Save the Junos OS configuration to a file so that you can edit it with a text editor of your choice. You can save your current configuration to an ASCII file, which saves the configuration in its current form, including any uncommitted changes. If more than one user is modifying the configuration, all changes made by all users are saved.
To save software configuration changes to an ASCII file, use the save configuration mode command:
The contents of the current level of the statement hierarchy (and below) are saved, along with the statement hierarchy containing it. This allows a section of the configuration to be saved, while fully specifying the statement hierarchy.
By default, the configuration is saved to a file in your home directory, which is on the flash drive.
When you issue this command from anywhere in the hierarchy (except the top level), a replace tag is automatically included at the beginning of the file. You can use the replace tag to control how a configuration is loaded from a file.
Related Documentation
- ACX, EX, J, M, MX, PTX, QFX, T Series
- Returning to the Most Recently Committed Junos Configuration
- Loading a Configuration from a File
- EX, M, MX, QFX, T Series
- Viewing Files and Directories on a Device Running Junos OS
Published: 2013-01-23
Supported Platforms
Related Documentation
- ACX, EX, J, M, MX, PTX, QFX, T Series
- Returning to the Most Recently Committed Junos Configuration
- Loading a Configuration from a File
- EX, M, MX, QFX, T Series
- Viewing Files and Directories on a Device Running Junos OS