Junos rescue configuration file is helpful in the situation that your device’s configuration file has been misconfigured or lost. It allows you to define a known or healthy configuration as a rescue configuration that you can roll back to at any time.
Junos Rescue configuration file fundamental
The question is that, why we do not use default automatic configuration backups which is taken by every commit command.
Actually it is not easy to remember the healthy rollback configuration number with a specific date and time which can be loaded in emergency situation. Additionally every configuration backup will be removed after 50 commit commands since, maximum, 50 configuration backup will be stored in the device.
The solution is to take a healthy configuration as rescue configuration and you can restore the device to this rescue configuration in emergency situation when configuration is lost or misconfigured. Rescue configuration will not be deleted or changed with commit commands.
If you save this file remotely, the rescue configuration can also be used to restore your device in the event of a software failure.
Another solution is to use your custom backup policy using “save” and “load” command which is discussed in the previous section.
Junos Rescue Configuration File Setup
create Rescue configuration file in Junos
To create a rescue configuration file, in the CLI operational mode, you can save the current healthy and active configuration as the rescue configuration file with the command “request system configuration rescue save”.
To verify if a rescue configuration file is correct, use the command “test configuration /config/rescue.conf.gz” from operational mode.
Then it is recommended to copy the Rescue file also in a remote server so it can also be used to restore your device in the event of a software failure.
Rolling Back to the Rescue Configuration
In emergency cases, manually roll back to the rescue configuration to bring your device back to normal running mode. to do that, issue the command “rollback rescue” from the configuration mode.
To test it, I change the hostname to something else. Then I will try to roll back the configuration with rescue file.
Notice that loaded rescue configuration will be loaded to candidate configuration. Then you can make sure of the rescue configuration with “show | compare” command. Then will “commit” command, it will be applied to the active configuration.
% exit exit [email protected]vSRX> configure Entering configuration mode  [email protected]# set system host-name vSRX6  [email protected]# commit commit complete  [email protected]vSRX6# rollback rescue load complete  [email protected]# show | compare [edit system] - host-name vSRX6; + host-name vSRX;  [email protected]# commit commit complete  [email protected]vSRX#
As you can see, the hostname is reverted back to what was configured in rescue configuration.