Junos Rescue Configuration: Save and Recover Quickly - 夜莺博客

Junos Rescue Configuration: Save and Recover Quickly

Every Junos administrator knows the feeling: a commit that looked harmless takes the device offline, and the rollback numbers have scrolled out of memory. The Junos rescue configuration solves this by giving you a permanent, named snapshot of a known-good configuration that survives across reboots and does not depend on remembering rollback numbers. If the active configuration becomes corrupted, a Junos device can even load the rescue configuration automatically at boot. This guide covers how to save, roll back to, verify, and delete the rescue configuration on Junos OS and Junos OS Evolved.

What the Rescue Configuration Does

The rescue configuration is a copy of a committed, known-working configuration stored as /config/rescue.conf.gz (on dual Routing Engine systems it is saved on both REs). Its main benefit is recovery: instead of hunting through show system rollback output for the right revision, you issue one command to load the rescue image of the configuration and commit it.

Saving the Rescue Configuration

Save the most recently committed configuration as the rescue configuration from operational mode:

user@host> request system configuration rescue save

Best practice: save a fresh rescue after every major maintenance window or successful change, so it always reflects a state you trust rather than an ancient baseline.

Rolling Back to the Rescue Configuration

To recover, load the rescue configuration from configuration mode and commit it:

[edit]
user@host# rollback rescue
load complete
user@host# commit

If no rescue configuration exists, or the rescue file is incomplete, the rollback fails with an error and your active configuration is left untouched - so verify that a rescue exists before you need it.

Verifying and Testing the Rescue File

You can validate the syntax of the rescue configuration without committing it:

user@host> test configuration /config/rescue.conf.gz
configuration check succeeds

Deleting and Copying the Rescue Configuration

To remove an existing rescue configuration (for example before repurposing the device):

user@host> request system configuration rescue delete

Off-box copies are a recommended extra safety net - copy the rescue file to a server so a total disk failure does not take your known-good state with it:

user@host> file copy /config/rescue.conf.gz scp://user@192.0.2.10/tftpboot/

See also our guides on Junos commit confirmed and rollback, Junos password recovery, and Junos apply-groups configuration.

原文链接:https://www.juniper.net/documentation/us/en/software/junos/cli/topics/topic-map/junos-rescue-configuration.html