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.

Junos Rescue Configuration File
Junos Rescue Configuration File

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”.

rayka@vSRX> request system configuration rescue save 

rayka@vSRX>

To verify if a rescue configuration file is correct, use the command “test configuration /config/rescue.conf.gz” from operational mode.

rayka@vSRX> test configuration /config/rescue.conf.gz 
configuration check succeeds

rayka@vSRX>

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.

rayka@vSRX> start shell 
% cd /config
% ls -lrt rescue.conf.gz
-rw-r-----  1 root  wheel  1151 May 11 18:48 rescue.conf.gz
% scp /config/rescue.conf.gz majid@192.168.200.111:/home/majid/
majid@192.168.200.111's password: 
rescue.conf.gz                                                                                                    100% 1151   130.2KB/s   00:00    
% 

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

rayka@vSRX> configure 
Entering configuration mode

[edit]
rayka@vSRX# set system host-name vSRX6 

[edit]
rayka@vSRX# commit 
commit complete

[edit]
rayka@vSRX6# rollback rescue 
load complete

[edit]
rayka@vSRX6# show | compare 
[edit system]
-  host-name vSRX6;
+  host-name vSRX;

[edit]
rayka@vSRX6# commit 
commit complete

[edit]
rayka@vSRX# 

As you can see, the hostname is reverted back to what was configured in rescue configuration.

Back to: Juniper Junos Associate version 22.1R1.10 (JNCIA-Junos) > Junos User Interfaces

Leave a Reply

Your email address will not be published. Required fields are marked *


Post comment